satellite/metainfo: disable DeletePart method
We can now overwrite segments in pending objects so we should stop using this method. Change-Id: Ib24bd53e1a73d8c380b89a994a3cd8d178f4c533
This commit is contained in:
parent
56fe636123
commit
96dc43fd49
@ -2313,50 +2313,15 @@ func (endpoint *Endpoint) DownloadSegment(ctx context.Context, req *pb.SegmentDo
|
||||
}, nil
|
||||
}
|
||||
|
||||
// DeletePart deletes a single part from satellite db and from storage nodes.
|
||||
// DeletePart is a no-op.
|
||||
//
|
||||
// It was used to perform the deletion of a single part from satellite db and
|
||||
// from storage nodes. We made this method noop because now we can overwrite
|
||||
// segments for pending objects. It's returning no error to avoid failures with
|
||||
// uplinks that still are using this method.
|
||||
func (endpoint *Endpoint) DeletePart(ctx context.Context, req *pb.PartDeleteRequest) (resp *pb.PartDeleteResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
err = endpoint.versionCollector.collect(req.Header.UserAgent, mon.Func().ShortName())
|
||||
if err != nil {
|
||||
endpoint.log.Warn("unable to collect uplink version", zap.Error(err))
|
||||
}
|
||||
|
||||
streamID, err := endpoint.unmarshalSatStreamID(ctx, req.StreamId)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.InvalidArgument, err.Error())
|
||||
}
|
||||
|
||||
_, err = endpoint.validateAuth(ctx, req.Header, macaroon.Action{
|
||||
Op: macaroon.ActionDelete,
|
||||
Bucket: streamID.Bucket,
|
||||
EncryptedPath: streamID.EncryptedObjectKey,
|
||||
Time: time.Now(),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
id, err := uuid.FromBytes(streamID.StreamId)
|
||||
if err != nil {
|
||||
endpoint.log.Error("internal", zap.Error(err))
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
|
||||
err = endpoint.metabase.DeletePart(ctx, metabase.DeletePart{
|
||||
StreamID: id,
|
||||
PartNumber: uint32(req.PartNumber),
|
||||
|
||||
DeletePieces: func(ctx context.Context, segment metabase.DeletedSegmentInfo) error {
|
||||
endpoint.deleteSegmentPieces(ctx, []metabase.DeletedSegmentInfo{segment})
|
||||
return nil
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
endpoint.log.Error("internal", zap.Error(err))
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
|
||||
return &pb.PartDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user