StatShard return shard stat
(ctx context.Context, location proto.VunitLocation, bid proto.BlobID)
| 105 | |
| 106 | // StatShard return shard stat |
| 107 | func (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 |
| 127 | func (c *BlobNodeClient) ListShards(ctx context.Context, location proto.VunitLocation) (sis []*ShardInfo, err error) { |
nothing calls this directly
no test coverage detected