aboutsummaryrefslogtreecommitdiff
path: root/weed/server/volume_grpc_admin.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-04-01 16:37:06 -0700
committerchrislu <chris.lu@gmail.com>2022-04-01 16:37:06 -0700
commit800cbc004c84a5113076fdbb70e93d53e8434073 (patch)
tree1e3076f96a81d6a17a57a344657996ca9b34ae0e /weed/server/volume_grpc_admin.go
parent7fdd29c234390c09eb48e2b59200eaeb0a41637b (diff)
downloadseaweedfs-800cbc004c84a5113076fdbb70e93d53e8434073.tar.xz
seaweedfs-800cbc004c84a5113076fdbb70e93d53e8434073.zip
volume server adds ping function
Diffstat (limited to 'weed/server/volume_grpc_admin.go')
-rw-r--r--weed/server/volume_grpc_admin.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/weed/server/volume_grpc_admin.go b/weed/server/volume_grpc_admin.go
index 898c3da12..d37ebf050 100644
--- a/weed/server/volume_grpc_admin.go
+++ b/weed/server/volume_grpc_admin.go
@@ -3,6 +3,7 @@ package weed_server
import (
"context"
"fmt"
+ "github.com/chrislusf/seaweedfs/weed/pb"
"path/filepath"
"github.com/chrislusf/seaweedfs/weed/glog"
@@ -247,3 +248,14 @@ func (vs *VolumeServer) VolumeNeedleStatus(ctx context.Context, req *volume_serv
return resp, nil
}
+
+func (vs *VolumeServer) Ping(ctx context.Context, req *volume_server_pb.PingRequest) (resp *volume_server_pb.PingResponse, pingErr error) {
+ resp = &volume_server_pb.PingResponse{}
+ if req.TargetType == "VolumeServer" {
+ pingErr = pb.WithVolumeServerClient(false, pb.ServerAddress(req.Target), vs.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {
+ _, err := client.Ping(ctx, &volume_server_pb.PingRequest{})
+ return err
+ })
+ }
+ return
+}