aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/commands.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-10-28 12:53:23 -0700
committerchrislu <chris.lu@gmail.com>2022-10-28 12:53:23 -0700
commit0d9f2f9e7a3a4cda273ef1d057c7f2b052b985d9 (patch)
tree3020c8bd10e1a675c260f5c9a8c404bc5bdf8984 /weed/shell/commands.go
parentea2637734a13a08d11d4f26e80c1324664bf7ffc (diff)
parent764d9cb1059e5210927c7faca79012578fe69119 (diff)
downloadseaweedfs-0d9f2f9e7a3a4cda273ef1d057c7f2b052b985d9.tar.xz
seaweedfs-0d9f2f9e7a3a4cda273ef1d057c7f2b052b985d9.zip
Merge branch 'master' of https://github.com/seaweedfs/seaweedfs
Diffstat (limited to 'weed/shell/commands.go')
-rw-r--r--weed/shell/commands.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/weed/shell/commands.go b/weed/shell/commands.go
index 87aeed2bb..66fdcb6bd 100644
--- a/weed/shell/commands.go
+++ b/weed/shell/commands.go
@@ -1,7 +1,11 @@
package shell
import (
+ "context"
"fmt"
+ "github.com/seaweedfs/seaweedfs/weed/operation"
+ "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
+ "github.com/seaweedfs/seaweedfs/weed/storage/needle_map"
"io"
"net/url"
"strconv"
@@ -148,3 +152,20 @@ func findInputDirectory(args []string) (input string) {
}
return input
}
+
+func readNeedleMeta(grpcDialOption grpc.DialOption, volumeServer pb.ServerAddress, volumeId uint32, needleValue needle_map.NeedleValue) (resp *volume_server_pb.ReadNeedleMetaResponse, err error) {
+ err = operation.WithVolumeServerClient(false, volumeServer, grpcDialOption,
+ func(client volume_server_pb.VolumeServerClient) error {
+ if resp, err = client.ReadNeedleMeta(context.Background(), &volume_server_pb.ReadNeedleMetaRequest{
+ VolumeId: volumeId,
+ NeedleId: uint64(needleValue.Key),
+ Offset: needleValue.Offset.ToActualOffset(),
+ Size: int32(needleValue.Size),
+ }); err != nil {
+ return err
+ }
+ return nil
+ },
+ )
+ return
+}