aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/commands.go
diff options
context:
space:
mode:
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
+}