MCPcopy
hub / github.com/cubefs/cubefs / StatShard

Method StatShard

blobstore/blobnode/client/blobnode_cli.go:107–124  ·  view source on GitHub ↗

StatShard return shard stat

(ctx context.Context, location proto.VunitLocation, bid proto.BlobID)

Source from the content-addressed store, hash-verified

105
106// StatShard return shard stat
107func (c *BlobNodeClient) StatShard(ctx context.Context, location proto.VunitLocation, bid proto.BlobID) (si *ShardInfo, err error) {
108 ctx = trace.NewContextFromContext(ctx)
109 span := trace.SpanFromContext(ctx).WithOperation("StatShard")
110 info, err := c.cli.StatShard(ctx, location.Host, &api.StatShardArgs{DiskID: location.DiskID, Vuid: location.Vuid, Bid: bid})
111 if err != nil {
112 if errCode := rpc.DetectStatusCode(err); errCode == errcode.CodeBidNotFound {
113 span.Debugf("StatShard not found and set flag ShardStatusNotExist: location[%+v], bid[%d]", location, bid)
114 var info2 ShardInfo
115 info2.Vuid = location.Vuid
116 info2.Bid = bid
117 info2.Flag = ShardStatusNotExist
118 return &info2, nil
119 }
120 return nil, err
121 }
122 span.Debugf("StatShard success: location[%+v], bid[%d], shard info[%+v]", location, bid, info)
123 return &ShardInfo{*info}, nil
124}
125
126// ListShards return shards info
127func (c *BlobNodeClient) ListShards(ctx context.Context, location proto.VunitLocation) (sis []*ShardInfo, err error) {

Callers

nothing calls this directly

Calls 6

NewContextFromContextFunction · 0.92
SpanFromContextFunction · 0.92
DetectStatusCodeFunction · 0.92
WithOperationMethod · 0.65
StatShardMethod · 0.65
DebugfMethod · 0.65

Tested by

no test coverage detected