Skip to content

Commit

Permalink
satellite/metainfo: etag support for committing and listing segments
Browse files Browse the repository at this point in the history
Change-Id: I9a4cdf0cffa887efc856b191ee0939c11e8391e7
  • Loading branch information
kaloyan-raev committed Mar 25, 2021
1 parent ec929ca commit 8e1aa4b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions satellite/metainfo/metainfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1519,6 +1519,8 @@ func (endpoint *Endpoint) commitSegment(ctx context.Context, req *pb.SegmentComm
EncryptedSize: int32(req.SizeEncryptedData), // TODO incompatible types int32 vs int64
PlainSize: int32(req.PlainSize), // TODO incompatible types int32 vs int64

EncryptedETag: req.EncryptedETag,

Position: metabase.SegmentPosition{
Part: uint32(segmentID.PartNumber),
Index: uint32(segmentID.Index),
Expand Down Expand Up @@ -1616,7 +1618,8 @@ func (endpoint *Endpoint) makeInlineSegment(ctx context.Context, req *pb.Segment
Index: uint32(req.Position.Index),
},

PlainSize: int32(req.PlainSize), // TODO incompatible types int32 vs int64
PlainSize: int32(req.PlainSize), // TODO incompatible types int32 vs int64
EncryptedETag: req.EncryptedETag,

InlineData: req.EncryptedInlineData,
})
Expand Down Expand Up @@ -1710,11 +1713,19 @@ func (endpoint *Endpoint) ListSegments(ctx context.Context, req *pb.SegmentListR
if item.CreatedAt != nil {
items[i].CreatedAt = *item.CreatedAt
}
items[i].EncryptedETag = item.EncryptedETag
items[i].EncryptedKeyNonce, err = storj.NonceFromBytes(item.EncryptedKeyNonce)
if err != nil {
endpoint.log.Error("unable to get encryption key nonce from metadata", zap.Error(err))
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
}
items[i].EncryptedKey = item.EncryptedKey
}

return &pb.SegmentListResponse{
Items: items,
More: result.More,
Items: items,
More: result.More,
EncryptionParameters: streamID.EncryptionParameters,
}, nil
}

Expand Down

0 comments on commit 8e1aa4b

Please sign in to comment.