Skip to content

Commit

Permalink
renterd: use metadatastore for GetSize
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Mar 5, 2024
1 parent c551056 commit ea93be0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion renterd/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ func (bs *BlockStore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error)
func (bs *BlockStore) GetSize(ctx context.Context, c cid.Cid) (int, error) {
key := cidKey(c)
log := bs.log.Named("GetSize").With(zap.Stringer("cid", c), zap.String("key", key))
stat, err := bs.busClient.Object(ctx, bs.bucket, key, api.GetObjectOptions{})

bucket, key, err := bs.metadata.BlockLocation(c)
if err != nil {
return 0, err
}

stat, err := bs.busClient.Object(ctx, bucket, key, api.GetObjectOptions{})
if err != nil {
if !strings.Contains(err.Error(), "object not found") {
log.Debug("failed to get block size", zap.Error(err))
Expand Down

0 comments on commit ea93be0

Please sign in to comment.