Add 'Old' suffix to some metainfo methods/messages (#2462)
This commit is contained in:
parent
963e1b9710
commit
094e1b8b90
File diff suppressed because it is too large
Load Diff
@ -21,13 +21,14 @@ service Metainfo {
|
|||||||
rpc ListBuckets(BucketListRequest) returns (BucketListResponse);
|
rpc ListBuckets(BucketListRequest) returns (BucketListResponse);
|
||||||
rpc SetBucketAttribution(BucketSetAttributionRequest) returns (BucketSetAttributionResponse);
|
rpc SetBucketAttribution(BucketSetAttributionRequest) returns (BucketSetAttributionResponse);
|
||||||
|
|
||||||
rpc CreateSegment(SegmentWriteRequest) returns (SegmentWriteResponse);
|
rpc CreateSegmentOld(SegmentWriteRequestOld) returns (SegmentWriteResponseOld);
|
||||||
rpc CommitSegment(SegmentCommitRequest) returns (SegmentCommitResponse);
|
rpc CommitSegmentOld(SegmentCommitRequestOld) returns (SegmentCommitResponseOld);
|
||||||
rpc SegmentInfo(SegmentInfoRequest) returns (SegmentInfoResponse);
|
rpc SegmentInfoOld(SegmentInfoRequestOld) returns (SegmentInfoResponseOld);
|
||||||
rpc DownloadSegment(SegmentDownloadRequest) returns (SegmentDownloadResponse);
|
rpc DownloadSegmentOld(SegmentDownloadRequestOld) returns (SegmentDownloadResponseOld);
|
||||||
rpc DeleteSegment(SegmentDeleteRequest) returns (SegmentDeleteResponse);
|
rpc DeleteSegmentOld(SegmentDeleteRequestOld) returns (SegmentDeleteResponseOld);
|
||||||
rpc ListSegments(ListSegmentsRequest) returns (ListSegmentsResponse);
|
rpc ListSegmentsOld(ListSegmentsRequestOld) returns (ListSegmentsResponseOld);
|
||||||
rpc SetAttribution(SetAttributionRequest) returns (SetAttributionResponse);
|
rpc SetAttributionOld(SetAttributionRequestOld) returns (SetAttributionResponseOld);
|
||||||
|
|
||||||
rpc ProjectInfo(ProjectInfoRequest) returns (ProjectInfoResponse);
|
rpc ProjectInfo(ProjectInfoRequest) returns (ProjectInfoResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ message AddressedOrderLimit {
|
|||||||
node.NodeAddress storage_node_address = 2;
|
node.NodeAddress storage_node_address = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentWriteRequest {
|
message SegmentWriteRequestOld {
|
||||||
bytes bucket = 1;
|
bytes bucket = 1;
|
||||||
bytes path = 2;
|
bytes path = 2;
|
||||||
int64 segment = 3;
|
int64 segment = 3;
|
||||||
@ -110,12 +111,12 @@ message SegmentWriteRequest {
|
|||||||
google.protobuf.Timestamp expiration = 6;
|
google.protobuf.Timestamp expiration = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentWriteResponse {
|
message SegmentWriteResponseOld {
|
||||||
repeated AddressedOrderLimit addressed_limits = 1;
|
repeated AddressedOrderLimit addressed_limits = 1;
|
||||||
bytes root_piece_id = 2 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
|
bytes root_piece_id = 2 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentCommitRequest {
|
message SegmentCommitRequestOld {
|
||||||
bytes bucket = 1;
|
bytes bucket = 1;
|
||||||
bytes path = 2;
|
bytes path = 2;
|
||||||
int64 segment = 3;
|
int64 segment = 3;
|
||||||
@ -123,42 +124,42 @@ message SegmentCommitRequest {
|
|||||||
repeated orders.OrderLimit original_limits = 5;
|
repeated orders.OrderLimit original_limits = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentCommitResponse {
|
message SegmentCommitResponseOld {
|
||||||
pointerdb.Pointer pointer = 1;
|
pointerdb.Pointer pointer = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentDownloadRequest {
|
message SegmentDownloadRequestOld {
|
||||||
bytes bucket = 1;
|
bytes bucket = 1;
|
||||||
bytes path = 2;
|
bytes path = 2;
|
||||||
int64 segment = 3;
|
int64 segment = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentDownloadResponse {
|
message SegmentDownloadResponseOld {
|
||||||
repeated AddressedOrderLimit addressed_limits = 1;
|
repeated AddressedOrderLimit addressed_limits = 1;
|
||||||
pointerdb.Pointer pointer = 2;
|
pointerdb.Pointer pointer = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentInfoRequest {
|
message SegmentInfoRequestOld {
|
||||||
bytes bucket = 1;
|
bytes bucket = 1;
|
||||||
bytes path = 2;
|
bytes path = 2;
|
||||||
int64 segment = 3;
|
int64 segment = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentInfoResponse {
|
message SegmentInfoResponseOld {
|
||||||
pointerdb.Pointer pointer = 2;
|
pointerdb.Pointer pointer = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentDeleteRequest {
|
message SegmentDeleteRequestOld {
|
||||||
bytes bucket = 1;
|
bytes bucket = 1;
|
||||||
bytes path = 2;
|
bytes path = 2;
|
||||||
int64 segment = 3;
|
int64 segment = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SegmentDeleteResponse {
|
message SegmentDeleteResponseOld {
|
||||||
repeated AddressedOrderLimit addressed_limits = 1;
|
repeated AddressedOrderLimit addressed_limits = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListSegmentsRequest {
|
message ListSegmentsRequestOld {
|
||||||
bytes bucket = 1;
|
bytes bucket = 1;
|
||||||
bytes prefix = 2;
|
bytes prefix = 2;
|
||||||
bytes start_after = 3;
|
bytes start_after = 3;
|
||||||
@ -168,7 +169,7 @@ message ListSegmentsRequest {
|
|||||||
fixed32 meta_flags = 7;
|
fixed32 meta_flags = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListSegmentsResponse {
|
message ListSegmentsResponseOld {
|
||||||
message Item {
|
message Item {
|
||||||
bytes path = 1;
|
bytes path = 1;
|
||||||
pointerdb.Pointer pointer = 2;
|
pointerdb.Pointer pointer = 2;
|
||||||
@ -179,12 +180,12 @@ message ListSegmentsResponse {
|
|||||||
bool more = 2;
|
bool more = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SetAttributionRequest{
|
message SetAttributionRequestOld {
|
||||||
bytes bucket_name = 1;
|
bytes bucket_name = 1;
|
||||||
bytes partner_id = 2 ;
|
bytes partner_id = 2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SetAttributionResponse {
|
message SetAttributionResponseOld {
|
||||||
}
|
}
|
||||||
|
|
||||||
message ProjectInfoRequest {
|
message ProjectInfoRequest {
|
||||||
|
70
proto.lock
70
proto.lock
@ -1819,7 +1819,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentWriteRequest",
|
"name": "SegmentWriteRequestOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -1854,7 +1854,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentWriteResponse",
|
"name": "SegmentWriteResponseOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -1880,7 +1880,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentCommitRequest",
|
"name": "SegmentCommitRequestOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -1911,7 +1911,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentCommitResponse",
|
"name": "SegmentCommitResponseOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -1921,7 +1921,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentDownloadRequest",
|
"name": "SegmentDownloadRequestOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -1941,7 +1941,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentDownloadResponse",
|
"name": "SegmentDownloadResponseOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -1957,7 +1957,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentInfoRequest",
|
"name": "SegmentInfoRequestOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -1977,7 +1977,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentInfoResponse",
|
"name": "SegmentInfoResponseOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
@ -1987,7 +1987,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentDeleteRequest",
|
"name": "SegmentDeleteRequestOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -2007,7 +2007,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentDeleteResponse",
|
"name": "SegmentDeleteResponseOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -2018,7 +2018,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ListSegmentsRequest",
|
"name": "ListSegmentsRequestOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -2058,7 +2058,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ListSegmentsResponse",
|
"name": "ListSegmentsResponseOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -2096,7 +2096,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SetAttributionRequest",
|
"name": "SetAttributionRequestOld",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -2111,7 +2111,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SetAttributionResponse"
|
"name": "SetAttributionResponseOld"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ProjectInfoRequest"
|
"name": "ProjectInfoRequest"
|
||||||
@ -2157,39 +2157,39 @@
|
|||||||
"out_type": "BucketSetAttributionResponse"
|
"out_type": "BucketSetAttributionResponse"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "CreateSegment",
|
"name": "CreateSegmentOld",
|
||||||
"in_type": "SegmentWriteRequest",
|
"in_type": "SegmentWriteRequestOld",
|
||||||
"out_type": "SegmentWriteResponse"
|
"out_type": "SegmentWriteResponseOld"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "CommitSegment",
|
"name": "CommitSegmentOld",
|
||||||
"in_type": "SegmentCommitRequest",
|
"in_type": "SegmentCommitRequestOld",
|
||||||
"out_type": "SegmentCommitResponse"
|
"out_type": "SegmentCommitResponseOld"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SegmentInfo",
|
"name": "SegmentInfoOld",
|
||||||
"in_type": "SegmentInfoRequest",
|
"in_type": "SegmentInfoRequestOld",
|
||||||
"out_type": "SegmentInfoResponse"
|
"out_type": "SegmentInfoResponseOld"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "DownloadSegment",
|
"name": "DownloadSegmentOld",
|
||||||
"in_type": "SegmentDownloadRequest",
|
"in_type": "SegmentDownloadRequestOld",
|
||||||
"out_type": "SegmentDownloadResponse"
|
"out_type": "SegmentDownloadResponseOld"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "DeleteSegment",
|
"name": "DeleteSegmentOld",
|
||||||
"in_type": "SegmentDeleteRequest",
|
"in_type": "SegmentDeleteRequestOld",
|
||||||
"out_type": "SegmentDeleteResponse"
|
"out_type": "SegmentDeleteResponseOld"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ListSegments",
|
"name": "ListSegmentsOld",
|
||||||
"in_type": "ListSegmentsRequest",
|
"in_type": "ListSegmentsRequestOld",
|
||||||
"out_type": "ListSegmentsResponse"
|
"out_type": "ListSegmentsResponseOld"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "SetAttribution",
|
"name": "SetAttributionOld",
|
||||||
"in_type": "SetAttributionRequest",
|
"in_type": "SetAttributionRequestOld",
|
||||||
"out_type": "SetAttributionResponse"
|
"out_type": "SetAttributionResponseOld"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ProjectInfo",
|
"name": "ProjectInfo",
|
||||||
|
@ -88,8 +88,8 @@ func NewEndpoint(log *zap.Logger, metainfo *Service, orders *orders.Service, cac
|
|||||||
// Close closes resources
|
// Close closes resources
|
||||||
func (endpoint *Endpoint) Close() error { return nil }
|
func (endpoint *Endpoint) Close() error { return nil }
|
||||||
|
|
||||||
// SegmentInfo returns segment metadata info
|
// SegmentInfoOld returns segment metadata info
|
||||||
func (endpoint *Endpoint) SegmentInfo(ctx context.Context, req *pb.SegmentInfoRequest) (resp *pb.SegmentInfoResponse, err error) {
|
func (endpoint *Endpoint) SegmentInfoOld(ctx context.Context, req *pb.SegmentInfoRequestOld) (resp *pb.SegmentInfoResponseOld, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
||||||
@ -121,11 +121,11 @@ func (endpoint *Endpoint) SegmentInfo(ctx context.Context, req *pb.SegmentInfoRe
|
|||||||
return nil, status.Errorf(codes.Internal, err.Error())
|
return nil, status.Errorf(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.SegmentInfoResponse{Pointer: pointer}, nil
|
return &pb.SegmentInfoResponseOld{Pointer: pointer}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateSegment will generate requested number of OrderLimit with coresponding node addresses for them
|
// CreateSegmentOld will generate requested number of OrderLimit with coresponding node addresses for them
|
||||||
func (endpoint *Endpoint) CreateSegment(ctx context.Context, req *pb.SegmentWriteRequest) (resp *pb.SegmentWriteResponse, err error) {
|
func (endpoint *Endpoint) CreateSegmentOld(ctx context.Context, req *pb.SegmentWriteRequestOld) (resp *pb.SegmentWriteResponseOld, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
||||||
@ -194,7 +194,7 @@ func (endpoint *Endpoint) CreateSegment(ctx context.Context, req *pb.SegmentWrit
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.SegmentWriteResponse{AddressedLimits: addressedLimits, RootPieceId: rootPieceID}, nil
|
return &pb.SegmentWriteResponseOld{AddressedLimits: addressedLimits, RootPieceId: rootPieceID}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func calculateSpaceUsed(ptr *pb.Pointer) (inlineSpace, remoteSpace int64) {
|
func calculateSpaceUsed(ptr *pb.Pointer) (inlineSpace, remoteSpace int64) {
|
||||||
@ -213,8 +213,8 @@ func calculateSpaceUsed(ptr *pb.Pointer) (inlineSpace, remoteSpace int64) {
|
|||||||
return 0, pieceSize * int64(len(pieces))
|
return 0, pieceSize * int64(len(pieces))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommitSegment commits segment metadata
|
// CommitSegmentOld commits segment metadata
|
||||||
func (endpoint *Endpoint) CommitSegment(ctx context.Context, req *pb.SegmentCommitRequest) (resp *pb.SegmentCommitResponse, err error) {
|
func (endpoint *Endpoint) CommitSegmentOld(ctx context.Context, req *pb.SegmentCommitRequestOld) (resp *pb.SegmentCommitResponseOld, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
||||||
@ -276,11 +276,11 @@ func (endpoint *Endpoint) CommitSegment(ctx context.Context, req *pb.SegmentComm
|
|||||||
endpoint.createRequests.Remove(req.OriginalLimits[0].SerialNumber)
|
endpoint.createRequests.Remove(req.OriginalLimits[0].SerialNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.SegmentCommitResponse{Pointer: pointer}, nil
|
return &pb.SegmentCommitResponseOld{Pointer: pointer}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DownloadSegment gets Pointer incase of INLINE data or list of OrderLimit necessary to download remote data
|
// DownloadSegmentOld gets Pointer incase of INLINE data or list of OrderLimit necessary to download remote data
|
||||||
func (endpoint *Endpoint) DownloadSegment(ctx context.Context, req *pb.SegmentDownloadRequest) (resp *pb.SegmentDownloadResponse, err error) {
|
func (endpoint *Endpoint) DownloadSegmentOld(ctx context.Context, req *pb.SegmentDownloadRequestOld) (resp *pb.SegmentDownloadResponseOld, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
||||||
@ -331,7 +331,7 @@ func (endpoint *Endpoint) DownloadSegment(ctx context.Context, req *pb.SegmentDo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, err.Error())
|
return nil, status.Errorf(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
return &pb.SegmentDownloadResponse{Pointer: pointer}, nil
|
return &pb.SegmentDownloadResponseOld{Pointer: pointer}, nil
|
||||||
} else if pointer.Type == pb.Pointer_REMOTE && pointer.Remote != nil {
|
} else if pointer.Type == pb.Pointer_REMOTE && pointer.Remote != nil {
|
||||||
uplinkIdentity, err := identity.PeerIdentityFromContext(ctx)
|
uplinkIdentity, err := identity.PeerIdentityFromContext(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -342,14 +342,14 @@ func (endpoint *Endpoint) DownloadSegment(ctx context.Context, req *pb.SegmentDo
|
|||||||
return nil, status.Errorf(codes.Internal, err.Error())
|
return nil, status.Errorf(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.SegmentDownloadResponse{Pointer: pointer, AddressedLimits: limits}, nil
|
return &pb.SegmentDownloadResponseOld{Pointer: pointer, AddressedLimits: limits}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.SegmentDownloadResponse{}, nil
|
return &pb.SegmentDownloadResponseOld{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSegment deletes segment metadata from satellite and returns OrderLimit array to remove them from storage node
|
// DeleteSegmentOld deletes segment metadata from satellite and returns OrderLimit array to remove them from storage node
|
||||||
func (endpoint *Endpoint) DeleteSegment(ctx context.Context, req *pb.SegmentDeleteRequest) (resp *pb.SegmentDeleteResponse, err error) {
|
func (endpoint *Endpoint) DeleteSegmentOld(ctx context.Context, req *pb.SegmentDeleteRequestOld) (resp *pb.SegmentDeleteResponseOld, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
||||||
@ -406,14 +406,14 @@ func (endpoint *Endpoint) DeleteSegment(ctx context.Context, req *pb.SegmentDele
|
|||||||
return nil, status.Errorf(codes.Internal, err.Error())
|
return nil, status.Errorf(codes.Internal, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.SegmentDeleteResponse{AddressedLimits: limits}, nil
|
return &pb.SegmentDeleteResponseOld{AddressedLimits: limits}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.SegmentDeleteResponse{}, nil
|
return &pb.SegmentDeleteResponseOld{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListSegments returns all Path keys in the Pointers bucket
|
// ListSegmentsOld returns all Path keys in the Pointers bucket
|
||||||
func (endpoint *Endpoint) ListSegments(ctx context.Context, req *pb.ListSegmentsRequest) (resp *pb.ListSegmentsResponse, err error) {
|
func (endpoint *Endpoint) ListSegmentsOld(ctx context.Context, req *pb.ListSegmentsRequestOld) (resp *pb.ListSegmentsResponseOld, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
|
||||||
@ -436,16 +436,16 @@ func (endpoint *Endpoint) ListSegments(ctx context.Context, req *pb.ListSegments
|
|||||||
return nil, status.Errorf(codes.Internal, "ListV2: %v", err)
|
return nil, status.Errorf(codes.Internal, "ListV2: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
segmentItems := make([]*pb.ListSegmentsResponse_Item, len(items))
|
segmentItems := make([]*pb.ListSegmentsResponseOld_Item, len(items))
|
||||||
for i, item := range items {
|
for i, item := range items {
|
||||||
segmentItems[i] = &pb.ListSegmentsResponse_Item{
|
segmentItems[i] = &pb.ListSegmentsResponseOld_Item{
|
||||||
Path: []byte(item.Path),
|
Path: []byte(item.Path),
|
||||||
Pointer: item.Pointer,
|
Pointer: item.Pointer,
|
||||||
IsPrefix: item.IsPrefix,
|
IsPrefix: item.IsPrefix,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.ListSegmentsResponse{Items: segmentItems, More: more}, nil
|
return &pb.ListSegmentsResponseOld{Items: segmentItems, More: more}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func createBucketID(projectID uuid.UUID, bucket []byte) []byte {
|
func createBucketID(projectID uuid.UUID, bucket []byte) []byte {
|
||||||
@ -543,8 +543,8 @@ func CreatePath(ctx context.Context, projectID uuid.UUID, segmentIndex int64, bu
|
|||||||
return storj.JoinPaths(entries...), nil
|
return storj.JoinPaths(entries...), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAttribution tries to add attribution to the bucket.
|
// SetAttributionOld tries to add attribution to the bucket.
|
||||||
func (endpoint *Endpoint) SetAttribution(ctx context.Context, req *pb.SetAttributionRequest) (_ *pb.SetAttributionResponse, err error) {
|
func (endpoint *Endpoint) SetAttributionOld(ctx context.Context, req *pb.SetAttributionRequestOld) (_ *pb.SetAttributionResponseOld, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
// try to add an attribution that doesn't exist
|
// try to add an attribution that doesn't exist
|
||||||
@ -567,7 +567,7 @@ func (endpoint *Endpoint) SetAttribution(ctx context.Context, req *pb.SetAttribu
|
|||||||
_, err = endpoint.partnerinfo.Get(ctx, keyInfo.ProjectID, req.GetBucketName())
|
_, err = endpoint.partnerinfo.Get(ctx, keyInfo.ProjectID, req.GetBucketName())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
endpoint.log.Sugar().Info("Bucket:", string(req.BucketName), " PartnerID:", partnerID.String(), "already attributed")
|
endpoint.log.Sugar().Info("Bucket:", string(req.BucketName), " PartnerID:", partnerID.String(), "already attributed")
|
||||||
return &pb.SetAttributionResponse{}, nil
|
return &pb.SetAttributionResponseOld{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !attribution.ErrBucketNotAttributed.Has(err) {
|
if !attribution.ErrBucketNotAttributed.Has(err) {
|
||||||
@ -597,7 +597,7 @@ func (endpoint *Endpoint) SetAttribution(ctx context.Context, req *pb.SetAttribu
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, Error.Wrap(err)
|
return nil, Error.Wrap(err)
|
||||||
}
|
}
|
||||||
return &pb.SetAttributionResponse{}, nil
|
return &pb.SetAttributionResponseOld{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// bytesToUUID is used to convert []byte to UUID
|
// bytesToUUID is used to convert []byte to UUID
|
||||||
|
@ -150,7 +150,7 @@ func (endpoint *Endpoint) validateAuth(ctx context.Context, action macaroon.Acti
|
|||||||
return keyInfo, nil
|
return keyInfo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (endpoint *Endpoint) validateCreateSegment(ctx context.Context, req *pb.SegmentWriteRequest) (err error) {
|
func (endpoint *Endpoint) validateCreateSegment(ctx context.Context, req *pb.SegmentWriteRequestOld) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
err = endpoint.validateBucket(ctx, req.Bucket)
|
err = endpoint.validateBucket(ctx, req.Bucket)
|
||||||
@ -166,7 +166,7 @@ func (endpoint *Endpoint) validateCreateSegment(ctx context.Context, req *pb.Seg
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (endpoint *Endpoint) validateCommitSegment(ctx context.Context, req *pb.SegmentCommitRequest) (err error) {
|
func (endpoint *Endpoint) validateCommitSegment(ctx context.Context, req *pb.SegmentCommitRequestOld) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
err = endpoint.validateBucket(ctx, req.Bucket)
|
err = endpoint.validateBucket(ctx, req.Bucket)
|
||||||
|
@ -88,7 +88,7 @@ func (client *Client) CreateSegment(ctx context.Context, bucket string, path sto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := client.client.CreateSegment(ctx, &pb.SegmentWriteRequest{
|
response, err := client.client.CreateSegmentOld(ctx, &pb.SegmentWriteRequestOld{
|
||||||
Bucket: []byte(bucket),
|
Bucket: []byte(bucket),
|
||||||
Path: []byte(path),
|
Path: []byte(path),
|
||||||
Segment: segmentIndex,
|
Segment: segmentIndex,
|
||||||
@ -107,7 +107,7 @@ func (client *Client) CreateSegment(ctx context.Context, bucket string, path sto
|
|||||||
func (client *Client) CommitSegment(ctx context.Context, bucket string, path storj.Path, segmentIndex int64, pointer *pb.Pointer, originalLimits []*pb.OrderLimit) (savedPointer *pb.Pointer, err error) {
|
func (client *Client) CommitSegment(ctx context.Context, bucket string, path storj.Path, segmentIndex int64, pointer *pb.Pointer, originalLimits []*pb.OrderLimit) (savedPointer *pb.Pointer, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
response, err := client.client.CommitSegment(ctx, &pb.SegmentCommitRequest{
|
response, err := client.client.CommitSegmentOld(ctx, &pb.SegmentCommitRequestOld{
|
||||||
Bucket: []byte(bucket),
|
Bucket: []byte(bucket),
|
||||||
Path: []byte(path),
|
Path: []byte(path),
|
||||||
Segment: segmentIndex,
|
Segment: segmentIndex,
|
||||||
@ -125,7 +125,7 @@ func (client *Client) CommitSegment(ctx context.Context, bucket string, path sto
|
|||||||
func (client *Client) SegmentInfo(ctx context.Context, bucket string, path storj.Path, segmentIndex int64) (pointer *pb.Pointer, err error) {
|
func (client *Client) SegmentInfo(ctx context.Context, bucket string, path storj.Path, segmentIndex int64) (pointer *pb.Pointer, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
response, err := client.client.SegmentInfo(ctx, &pb.SegmentInfoRequest{
|
response, err := client.client.SegmentInfoOld(ctx, &pb.SegmentInfoRequestOld{
|
||||||
Bucket: []byte(bucket),
|
Bucket: []byte(bucket),
|
||||||
Path: []byte(path),
|
Path: []byte(path),
|
||||||
Segment: segmentIndex,
|
Segment: segmentIndex,
|
||||||
@ -144,7 +144,7 @@ func (client *Client) SegmentInfo(ctx context.Context, bucket string, path storj
|
|||||||
func (client *Client) ReadSegment(ctx context.Context, bucket string, path storj.Path, segmentIndex int64) (pointer *pb.Pointer, limits []*pb.AddressedOrderLimit, err error) {
|
func (client *Client) ReadSegment(ctx context.Context, bucket string, path storj.Path, segmentIndex int64) (pointer *pb.Pointer, limits []*pb.AddressedOrderLimit, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
response, err := client.client.DownloadSegment(ctx, &pb.SegmentDownloadRequest{
|
response, err := client.client.DownloadSegmentOld(ctx, &pb.SegmentDownloadRequestOld{
|
||||||
Bucket: []byte(bucket),
|
Bucket: []byte(bucket),
|
||||||
Path: []byte(path),
|
Path: []byte(path),
|
||||||
Segment: segmentIndex,
|
Segment: segmentIndex,
|
||||||
@ -181,7 +181,7 @@ func getLimitByStorageNodeID(limits []*pb.AddressedOrderLimit, storageNodeID sto
|
|||||||
func (client *Client) DeleteSegment(ctx context.Context, bucket string, path storj.Path, segmentIndex int64) (limits []*pb.AddressedOrderLimit, err error) {
|
func (client *Client) DeleteSegment(ctx context.Context, bucket string, path storj.Path, segmentIndex int64) (limits []*pb.AddressedOrderLimit, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
response, err := client.client.DeleteSegment(ctx, &pb.SegmentDeleteRequest{
|
response, err := client.client.DeleteSegmentOld(ctx, &pb.SegmentDeleteRequestOld{
|
||||||
Bucket: []byte(bucket),
|
Bucket: []byte(bucket),
|
||||||
Path: []byte(path),
|
Path: []byte(path),
|
||||||
Segment: segmentIndex,
|
Segment: segmentIndex,
|
||||||
@ -200,7 +200,7 @@ func (client *Client) DeleteSegment(ctx context.Context, bucket string, path sto
|
|||||||
func (client *Client) ListSegments(ctx context.Context, bucket string, prefix, startAfter, endBefore storj.Path, recursive bool, limit int32, metaFlags uint32) (items []ListItem, more bool, err error) {
|
func (client *Client) ListSegments(ctx context.Context, bucket string, prefix, startAfter, endBefore storj.Path, recursive bool, limit int32, metaFlags uint32) (items []ListItem, more bool, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
response, err := client.client.ListSegments(ctx, &pb.ListSegmentsRequest{
|
response, err := client.client.ListSegmentsOld(ctx, &pb.ListSegmentsRequestOld{
|
||||||
Bucket: []byte(bucket),
|
Bucket: []byte(bucket),
|
||||||
Prefix: []byte(prefix),
|
Prefix: []byte(prefix),
|
||||||
StartAfter: []byte(startAfter),
|
StartAfter: []byte(startAfter),
|
||||||
@ -230,7 +230,7 @@ func (client *Client) ListSegments(ctx context.Context, bucket string, prefix, s
|
|||||||
func (client *Client) SetAttribution(ctx context.Context, bucket string, partnerID uuid.UUID) (err error) {
|
func (client *Client) SetAttribution(ctx context.Context, bucket string, partnerID uuid.UUID) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
_, err = client.client.SetAttribution(ctx, &pb.SetAttributionRequest{
|
_, err = client.client.SetAttributionOld(ctx, &pb.SetAttributionRequestOld{
|
||||||
PartnerId: partnerID[:], // TODO: implement storj.UUID that can be sent using pb
|
PartnerId: partnerID[:], // TODO: implement storj.UUID that can be sent using pb
|
||||||
BucketName: []byte(bucket),
|
BucketName: []byte(bucket),
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user