This is an automated email from the ASF dual-hosted git repository.
liuhan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
The following commit(s) were added to refs/heads/main by this push:
new f55e3e44 Support node query gRPC service in lifecycle service (#956)
f55e3e44 is described below
commit f55e3e447b29477798bb9739211be460bbd18123
Author: mrproliu <[email protected]>
AuthorDate: Fri Jan 23 14:29:35 2026 +0800
Support node query gRPC service in lifecycle service (#956)
---
banyand/backup/lifecycle/current_node.go | 30 ++++++++++++++++++++++++++++++
banyand/backup/lifecycle/service.go | 14 ++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/banyand/backup/lifecycle/current_node.go
b/banyand/backup/lifecycle/current_node.go
new file mode 100644
index 00000000..4fb442f3
--- /dev/null
+++ b/banyand/backup/lifecycle/current_node.go
@@ -0,0 +1,30 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package lifecycle
+
+import (
+ "context"
+
+ databasev1
"github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
+)
+
+func (l *lifecycleService) GetCurrentNode(_ context.Context, _
*databasev1.GetCurrentNodeRequest) (*databasev1.GetCurrentNodeResponse, error) {
+ return &databasev1.GetCurrentNodeResponse{
+ Node: l.currentNode,
+ }, nil
+}
diff --git a/banyand/backup/lifecycle/service.go
b/banyand/backup/lifecycle/service.go
index 0c9cd5c7..85a78bf0 100644
--- a/banyand/backup/lifecycle/service.go
+++ b/banyand/backup/lifecycle/service.go
@@ -41,6 +41,7 @@ import (
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
+ "google.golang.org/protobuf/types/known/timestamppb"
"github.com/apache/skywalking-banyandb/api/common"
commonv1
"github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1"
@@ -70,6 +71,7 @@ var _ service = (*lifecycleService)(nil)
type lifecycleService struct {
databasev1.UnimplementedClusterStateServiceServer
+ databasev1.UnimplementedNodeQueryServiceServer
metadata metadata.Repo
omr observability.MetricsRegistry
pm protector.Memory
@@ -79,6 +81,7 @@ type lifecycleService struct {
grpcServer *grpclib.Server
httpSrv *http.Server
tlsReloader *pkgtls.Reloader
+ currentNode *databasev1.Node
clientCloser context.CancelFunc
stopCh chan struct{}
measureRoot string
@@ -165,6 +168,16 @@ func (l *lifecycleService) Validate() error {
return errors.New("missing key file when TLS is
enabled")
}
}
+ l.currentNode = &databasev1.Node{
+ Metadata: &commonv1.Metadata{
+ Name: l.lifecycleGRPCAddr,
+ },
+ GrpcAddress: l.lifecycleGRPCAddr,
+ HttpAddress: l.lifecycleHTTPAddr,
+ Roles: make([]databasev1.Role, 0),
+ Labels: common.ParseNodeFlags(),
+ CreatedAt: timestamppb.Now(),
+ }
}
return nil
}
@@ -309,6 +322,7 @@ func (l *lifecycleService) startServers() {
l.grpcServer = grpclib.NewServer(opts...)
databasev1.RegisterClusterStateServiceServer(l.grpcServer, l)
+ databasev1.RegisterNodeQueryServiceServer(l.grpcServer, l)
grpc_health_v1.RegisterHealthServer(l.grpcServer, health.NewServer())
// Setup HTTP server