From 5f4ee7e72e72f17771798f1a2df2012c12f64873 Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Wed, 26 May 2021 14:46:34 +0530 Subject: [PATCH 01/11] rename object handler grpc added --- .../blobbercore/blobbergrpc/blobber.pb.go | 337 +++++++++++++++--- .../blobbercore/blobbergrpc/blobber.pb.gw.go | 115 ++++++ .../blobbergrpc/blobber_grpc.pb.go | 46 ++- .../blobbergrpc/proto/blobber.proto | 24 ++ .../blobbercore/convert/responseHandler.go | 11 + .../0chain.net/blobbercore/handler/handler.go | 26 +- .../blobbercore/handler/handler_test.go | 2 +- .../0chain.net/blobbercore/handler/helper.go | 13 + .../handler/object_operation_grpc_handler.go | 98 +++++ .../blobbercore/openapi/blobber.swagger.json | 86 +++++ 10 files changed, 692 insertions(+), 66 deletions(-) diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go index 2d21e6a7b..972d362a3 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.6.1 +// protoc v3.17.0 // source: blobber.proto package blobbergrpc @@ -1321,6 +1321,174 @@ func (x *GetAllocationResponse) GetAllocation() *Allocation { return nil } +type RenameObjectRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + ConnectionId string `protobuf:"bytes,4,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + NewName string `protobuf:"bytes,5,opt,name=new_name,json=newName,proto3" json:"new_name,omitempty"` +} + +func (x *RenameObjectRequest) Reset() { + *x = RenameObjectRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RenameObjectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RenameObjectRequest) ProtoMessage() {} + +func (x *RenameObjectRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RenameObjectRequest.ProtoReflect.Descriptor instead. +func (*RenameObjectRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{20} +} + +func (x *RenameObjectRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +func (x *RenameObjectRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *RenameObjectRequest) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *RenameObjectRequest) GetConnectionId() string { + if x != nil { + return x.ConnectionId + } + return "" +} + +func (x *RenameObjectRequest) GetNewName() string { + if x != nil { + return x.NewName + } + return "" +} + +type RenameObjectResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + ContentHash string `protobuf:"bytes,3,opt,name=content_hash,json=contentHash,proto3" json:"content_hash,omitempty"` + MerkleRoot string `protobuf:"bytes,4,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"` + //UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer. + UploadLength int64 `protobuf:"varint,5,opt,name=upload_length,json=uploadLength,proto3" json:"upload_length,omitempty"` + //Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer. + UploadOffset int64 `protobuf:"varint,6,opt,name=upload_offset,json=uploadOffset,proto3" json:"upload_offset,omitempty"` +} + +func (x *RenameObjectResponse) Reset() { + *x = RenameObjectResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RenameObjectResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RenameObjectResponse) ProtoMessage() {} + +func (x *RenameObjectResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RenameObjectResponse.ProtoReflect.Descriptor instead. +func (*RenameObjectResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{21} +} + +func (x *RenameObjectResponse) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *RenameObjectResponse) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *RenameObjectResponse) GetContentHash() string { + if x != nil { + return x.ContentHash + } + return "" +} + +func (x *RenameObjectResponse) GetMerkleRoot() string { + if x != nil { + return x.MerkleRoot + } + return "" +} + +func (x *RenameObjectResponse) GetUploadLength() int64 { + if x != nil { + return x.UploadLength + } + return 0 +} + +func (x *RenameObjectResponse) GetUploadOffset() int64 { + if x != nil { + return x.UploadOffset + } + return 0 +} + type Allocation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1348,7 +1516,7 @@ type Allocation struct { func (x *Allocation) Reset() { *x = Allocation{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[20] + mi := &file_blobber_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1361,7 +1529,7 @@ func (x *Allocation) String() string { func (*Allocation) ProtoMessage() {} func (x *Allocation) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[20] + mi := &file_blobber_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1374,7 +1542,7 @@ func (x *Allocation) ProtoReflect() protoreflect.Message { // Deprecated: Use Allocation.ProtoReflect.Descriptor instead. func (*Allocation) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{20} + return file_blobber_proto_rawDescGZIP(), []int{22} } func (x *Allocation) GetID() string { @@ -1511,7 +1679,7 @@ type Term struct { func (x *Term) Reset() { *x = Term{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[21] + mi := &file_blobber_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1524,7 +1692,7 @@ func (x *Term) String() string { func (*Term) ProtoMessage() {} func (x *Term) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[21] + mi := &file_blobber_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1537,7 +1705,7 @@ func (x *Term) ProtoReflect() protoreflect.Message { // Deprecated: Use Term.ProtoReflect.Descriptor instead. func (*Term) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{21} + return file_blobber_proto_rawDescGZIP(), []int{23} } func (x *Term) GetID() int64 { @@ -1588,7 +1756,7 @@ type FileRef struct { func (x *FileRef) Reset() { *x = FileRef{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[22] + mi := &file_blobber_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1601,7 +1769,7 @@ func (x *FileRef) String() string { func (*FileRef) ProtoMessage() {} func (x *FileRef) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[22] + mi := &file_blobber_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1614,7 +1782,7 @@ func (x *FileRef) ProtoReflect() protoreflect.Message { // Deprecated: Use FileRef.ProtoReflect.Descriptor instead. func (*FileRef) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{22} + return file_blobber_proto_rawDescGZIP(), []int{24} } func (x *FileRef) GetType() string { @@ -1672,7 +1840,7 @@ type FileMetaData struct { func (x *FileMetaData) Reset() { *x = FileMetaData{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[23] + mi := &file_blobber_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1685,7 +1853,7 @@ func (x *FileMetaData) String() string { func (*FileMetaData) ProtoMessage() {} func (x *FileMetaData) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[23] + mi := &file_blobber_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1698,7 +1866,7 @@ func (x *FileMetaData) ProtoReflect() protoreflect.Message { // Deprecated: Use FileMetaData.ProtoReflect.Descriptor instead. func (*FileMetaData) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{23} + return file_blobber_proto_rawDescGZIP(), []int{25} } func (x *FileMetaData) GetType() string { @@ -1889,7 +2057,7 @@ type DirMetaData struct { func (x *DirMetaData) Reset() { *x = DirMetaData{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[24] + mi := &file_blobber_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1902,7 +2070,7 @@ func (x *DirMetaData) String() string { func (*DirMetaData) ProtoMessage() {} func (x *DirMetaData) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[24] + mi := &file_blobber_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1915,7 +2083,7 @@ func (x *DirMetaData) ProtoReflect() protoreflect.Message { // Deprecated: Use DirMetaData.ProtoReflect.Descriptor instead. func (*DirMetaData) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{24} + return file_blobber_proto_rawDescGZIP(), []int{26} } func (x *DirMetaData) GetType() string { @@ -2181,7 +2349,31 @@ var file_blobber_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb6, 0x04, 0x0a, 0x0a, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa6, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, + 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x23, + 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xd4, + 0x01, 0x0a, 0x14, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x65, + 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x75, + 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0xb6, 0x04, 0x0a, 0x0a, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x54, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, @@ -2304,7 +2496,7 @@ var file_blobber_proto_rawDesc = []byte{ 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x32, 0xe8, 0x07, 0x0a, + 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x32, 0xf5, 0x08, 0x0a, 0x07, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x12, 0x7c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, @@ -2367,10 +2559,19 @@ var file_blobber_proto_rawDesc = []byte{ 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x74, 0x72, 0x65, 0x65, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x42, 0x2c, 0x5a, 0x2a, 0x63, 0x6f, 0x64, 0x65, 0x2f, - 0x67, 0x6f, 0x2f, 0x30, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x62, 0x6c, - 0x6f, 0x62, 0x62, 0x65, 0x72, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, - 0x72, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x8a, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x6e, 0x61, + 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x72, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x7d, 0x3a, 0x01, 0x2a, 0x42, 0x2c, 0x5a, 0x2a, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x6f, 0x2f, + 0x30, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x67, 0x72, + 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2385,7 +2586,7 @@ func file_blobber_proto_rawDescGZIP() []byte { return file_blobber_proto_rawDescData } -var file_blobber_proto_msgTypes = make([]protoimpl.MessageInfo, 25) +var file_blobber_proto_msgTypes = make([]protoimpl.MessageInfo, 27) var file_blobber_proto_goTypes = []interface{}{ (*GetObjectTreeRequest)(nil), // 0: blobber.service.v1.GetObjectTreeRequest (*GetObjectTreeResponse)(nil), // 1: blobber.service.v1.GetObjectTreeResponse @@ -2407,34 +2608,36 @@ var file_blobber_proto_goTypes = []interface{}{ (*Collaborator)(nil), // 17: blobber.service.v1.Collaborator (*GetAllocationRequest)(nil), // 18: blobber.service.v1.GetAllocationRequest (*GetAllocationResponse)(nil), // 19: blobber.service.v1.GetAllocationResponse - (*Allocation)(nil), // 20: blobber.service.v1.Allocation - (*Term)(nil), // 21: blobber.service.v1.Term - (*FileRef)(nil), // 22: blobber.service.v1.FileRef - (*FileMetaData)(nil), // 23: blobber.service.v1.FileMetaData - (*DirMetaData)(nil), // 24: blobber.service.v1.DirMetaData + (*RenameObjectRequest)(nil), // 20: blobber.service.v1.RenameObjectRequest + (*RenameObjectResponse)(nil), // 21: blobber.service.v1.RenameObjectResponse + (*Allocation)(nil), // 22: blobber.service.v1.Allocation + (*Term)(nil), // 23: blobber.service.v1.Term + (*FileRef)(nil), // 24: blobber.service.v1.FileRef + (*FileMetaData)(nil), // 25: blobber.service.v1.FileMetaData + (*DirMetaData)(nil), // 26: blobber.service.v1.DirMetaData } var file_blobber_proto_depIdxs = []int32{ 4, // 0: blobber.service.v1.GetObjectTreeResponse.ReferencePath:type_name -> blobber.service.v1.ReferencePath 8, // 1: blobber.service.v1.GetObjectTreeResponse.LatestWM:type_name -> blobber.service.v1.WriteMarker 4, // 2: blobber.service.v1.GetReferencePathResponse.ReferencePath:type_name -> blobber.service.v1.ReferencePath 8, // 3: blobber.service.v1.GetReferencePathResponse.LatestWM:type_name -> blobber.service.v1.WriteMarker - 22, // 4: blobber.service.v1.ReferencePath.MetaData:type_name -> blobber.service.v1.FileRef + 24, // 4: blobber.service.v1.ReferencePath.MetaData:type_name -> blobber.service.v1.FileRef 4, // 5: blobber.service.v1.ReferencePath.List:type_name -> blobber.service.v1.ReferencePath 7, // 6: blobber.service.v1.GetObjectPathResponse.ObjectPath:type_name -> blobber.service.v1.ObjectPath 8, // 7: blobber.service.v1.GetObjectPathResponse.LatestWriteMarker:type_name -> blobber.service.v1.WriteMarker - 22, // 8: blobber.service.v1.ObjectPath.Meta:type_name -> blobber.service.v1.FileRef - 22, // 9: blobber.service.v1.ObjectPath.Path:type_name -> blobber.service.v1.FileRef - 22, // 10: blobber.service.v1.ObjectPath.PathList:type_name -> blobber.service.v1.FileRef - 22, // 11: blobber.service.v1.ListEntitiesResponse.MetaData:type_name -> blobber.service.v1.FileRef - 22, // 12: blobber.service.v1.ListEntitiesResponse.Entities:type_name -> blobber.service.v1.FileRef - 22, // 13: blobber.service.v1.GetFileStatsResponse.MetaData:type_name -> blobber.service.v1.FileRef + 24, // 8: blobber.service.v1.ObjectPath.Meta:type_name -> blobber.service.v1.FileRef + 24, // 9: blobber.service.v1.ObjectPath.Path:type_name -> blobber.service.v1.FileRef + 24, // 10: blobber.service.v1.ObjectPath.PathList:type_name -> blobber.service.v1.FileRef + 24, // 11: blobber.service.v1.ListEntitiesResponse.MetaData:type_name -> blobber.service.v1.FileRef + 24, // 12: blobber.service.v1.ListEntitiesResponse.Entities:type_name -> blobber.service.v1.FileRef + 24, // 13: blobber.service.v1.GetFileStatsResponse.MetaData:type_name -> blobber.service.v1.FileRef 13, // 14: blobber.service.v1.GetFileStatsResponse.Stats:type_name -> blobber.service.v1.FileStats - 22, // 15: blobber.service.v1.GetFileMetaDataResponse.MetaData:type_name -> blobber.service.v1.FileRef + 24, // 15: blobber.service.v1.GetFileMetaDataResponse.MetaData:type_name -> blobber.service.v1.FileRef 17, // 16: blobber.service.v1.GetFileMetaDataResponse.Collaborators:type_name -> blobber.service.v1.Collaborator - 20, // 17: blobber.service.v1.GetAllocationResponse.allocation:type_name -> blobber.service.v1.Allocation - 21, // 18: blobber.service.v1.Allocation.Terms:type_name -> blobber.service.v1.Term - 23, // 19: blobber.service.v1.FileRef.FileMetaData:type_name -> blobber.service.v1.FileMetaData - 24, // 20: blobber.service.v1.FileRef.DirMetaData:type_name -> blobber.service.v1.DirMetaData + 22, // 17: blobber.service.v1.GetAllocationResponse.allocation:type_name -> blobber.service.v1.Allocation + 23, // 18: blobber.service.v1.Allocation.Terms:type_name -> blobber.service.v1.Term + 25, // 19: blobber.service.v1.FileRef.FileMetaData:type_name -> blobber.service.v1.FileMetaData + 26, // 20: blobber.service.v1.FileRef.DirMetaData:type_name -> blobber.service.v1.DirMetaData 16, // 21: blobber.service.v1.FileMetaData.CommitMetaTxns:type_name -> blobber.service.v1.CommitMetaTxn 18, // 22: blobber.service.v1.Blobber.GetAllocation:input_type -> blobber.service.v1.GetAllocationRequest 14, // 23: blobber.service.v1.Blobber.GetFileMetaData:input_type -> blobber.service.v1.GetFileMetaDataRequest @@ -2443,15 +2646,17 @@ var file_blobber_proto_depIdxs = []int32{ 5, // 26: blobber.service.v1.Blobber.GetObjectPath:input_type -> blobber.service.v1.GetObjectPathRequest 2, // 27: blobber.service.v1.Blobber.GetReferencePath:input_type -> blobber.service.v1.GetReferencePathRequest 0, // 28: blobber.service.v1.Blobber.GetObjectTree:input_type -> blobber.service.v1.GetObjectTreeRequest - 19, // 29: blobber.service.v1.Blobber.GetAllocation:output_type -> blobber.service.v1.GetAllocationResponse - 15, // 30: blobber.service.v1.Blobber.GetFileMetaData:output_type -> blobber.service.v1.GetFileMetaDataResponse - 12, // 31: blobber.service.v1.Blobber.GetFileStats:output_type -> blobber.service.v1.GetFileStatsResponse - 10, // 32: blobber.service.v1.Blobber.ListEntities:output_type -> blobber.service.v1.ListEntitiesResponse - 6, // 33: blobber.service.v1.Blobber.GetObjectPath:output_type -> blobber.service.v1.GetObjectPathResponse - 3, // 34: blobber.service.v1.Blobber.GetReferencePath:output_type -> blobber.service.v1.GetReferencePathResponse - 1, // 35: blobber.service.v1.Blobber.GetObjectTree:output_type -> blobber.service.v1.GetObjectTreeResponse - 29, // [29:36] is the sub-list for method output_type - 22, // [22:29] is the sub-list for method input_type + 20, // 29: blobber.service.v1.Blobber.RenameObject:input_type -> blobber.service.v1.RenameObjectRequest + 19, // 30: blobber.service.v1.Blobber.GetAllocation:output_type -> blobber.service.v1.GetAllocationResponse + 15, // 31: blobber.service.v1.Blobber.GetFileMetaData:output_type -> blobber.service.v1.GetFileMetaDataResponse + 12, // 32: blobber.service.v1.Blobber.GetFileStats:output_type -> blobber.service.v1.GetFileStatsResponse + 10, // 33: blobber.service.v1.Blobber.ListEntities:output_type -> blobber.service.v1.ListEntitiesResponse + 6, // 34: blobber.service.v1.Blobber.GetObjectPath:output_type -> blobber.service.v1.GetObjectPathResponse + 3, // 35: blobber.service.v1.Blobber.GetReferencePath:output_type -> blobber.service.v1.GetReferencePathResponse + 1, // 36: blobber.service.v1.Blobber.GetObjectTree:output_type -> blobber.service.v1.GetObjectTreeResponse + 21, // 37: blobber.service.v1.Blobber.RenameObject:output_type -> blobber.service.v1.RenameObjectResponse + 30, // [30:38] is the sub-list for method output_type + 22, // [22:30] is the sub-list for method input_type 22, // [22:22] is the sub-list for extension type_name 22, // [22:22] is the sub-list for extension extendee 0, // [0:22] is the sub-list for field type_name @@ -2704,7 +2909,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Allocation); i { + switch v := v.(*RenameObjectRequest); i { case 0: return &v.state case 1: @@ -2716,7 +2921,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Term); i { + switch v := v.(*RenameObjectResponse); i { case 0: return &v.state case 1: @@ -2728,7 +2933,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileRef); i { + switch v := v.(*Allocation); i { case 0: return &v.state case 1: @@ -2740,7 +2945,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileMetaData); i { + switch v := v.(*Term); i { case 0: return &v.state case 1: @@ -2752,6 +2957,30 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileRef); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileMetaData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DirMetaData); i { case 0: return &v.state @@ -2770,7 +2999,7 @@ func file_blobber_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_blobber_proto_rawDesc, NumEnums: 0, - NumMessages: 25, + NumMessages: 27, NumExtensions: 0, NumServices: 1, }, diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go index 50dc6d47f..8516e3e02 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go @@ -487,6 +487,74 @@ func local_request_Blobber_GetObjectTree_0(ctx context.Context, marshaler runtim } +func request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RenameObjectRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.RenameObject(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RenameObjectRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.RenameObject(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterBlobberHandlerServer registers the http handlers for service Blobber to "mux". // UnaryRPC :call BlobberServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -654,6 +722,29 @@ func RegisterBlobberHandlerServer(ctx context.Context, mux *runtime.ServeMux, se }) + mux.Handle("POST", pattern_Blobber_RenameObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/RenameObject") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_RenameObject_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_RenameObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -835,6 +926,26 @@ func RegisterBlobberHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl }) + mux.Handle("POST", pattern_Blobber_RenameObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/RenameObject") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_RenameObject_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_RenameObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -852,6 +963,8 @@ var ( pattern_Blobber_GetReferencePath_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "referencepath", "allocation"}, "")) pattern_Blobber_GetObjectTree_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "objecttree", "allocation"}, "")) + + pattern_Blobber_RenameObject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "file", "rename", "allocation"}, "")) ) var ( @@ -868,4 +981,6 @@ var ( forward_Blobber_GetReferencePath_0 = runtime.ForwardResponseMessage forward_Blobber_GetObjectTree_0 = runtime.ForwardResponseMessage + + forward_Blobber_RenameObject_0 = runtime.ForwardResponseMessage ) diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go index e73fdcaf5..126b9e98c 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go @@ -11,6 +11,7 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // BlobberClient is the client API for Blobber service. @@ -24,6 +25,7 @@ type BlobberClient interface { GetObjectPath(ctx context.Context, in *GetObjectPathRequest, opts ...grpc.CallOption) (*GetObjectPathResponse, error) GetReferencePath(ctx context.Context, in *GetReferencePathRequest, opts ...grpc.CallOption) (*GetReferencePathResponse, error) GetObjectTree(ctx context.Context, in *GetObjectTreeRequest, opts ...grpc.CallOption) (*GetObjectTreeResponse, error) + RenameObject(ctx context.Context, in *RenameObjectRequest, opts ...grpc.CallOption) (*RenameObjectResponse, error) } type blobberClient struct { @@ -97,6 +99,15 @@ func (c *blobberClient) GetObjectTree(ctx context.Context, in *GetObjectTreeRequ return out, nil } +func (c *blobberClient) RenameObject(ctx context.Context, in *RenameObjectRequest, opts ...grpc.CallOption) (*RenameObjectResponse, error) { + out := new(RenameObjectResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/RenameObject", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // BlobberServer is the server API for Blobber service. // All implementations must embed UnimplementedBlobberServer // for forward compatibility @@ -108,6 +119,7 @@ type BlobberServer interface { GetObjectPath(context.Context, *GetObjectPathRequest) (*GetObjectPathResponse, error) GetReferencePath(context.Context, *GetReferencePathRequest) (*GetReferencePathResponse, error) GetObjectTree(context.Context, *GetObjectTreeRequest) (*GetObjectTreeResponse, error) + RenameObject(context.Context, *RenameObjectRequest) (*RenameObjectResponse, error) mustEmbedUnimplementedBlobberServer() } @@ -136,6 +148,9 @@ func (UnimplementedBlobberServer) GetReferencePath(context.Context, *GetReferenc func (UnimplementedBlobberServer) GetObjectTree(context.Context, *GetObjectTreeRequest) (*GetObjectTreeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetObjectTree not implemented") } +func (UnimplementedBlobberServer) RenameObject(context.Context, *RenameObjectRequest) (*RenameObjectResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RenameObject not implemented") +} func (UnimplementedBlobberServer) mustEmbedUnimplementedBlobberServer() {} // UnsafeBlobberServer may be embedded to opt out of forward compatibility for this service. @@ -145,8 +160,8 @@ type UnsafeBlobberServer interface { mustEmbedUnimplementedBlobberServer() } -func RegisterBlobberServer(s *grpc.Server, srv BlobberServer) { - s.RegisterService(&_Blobber_serviceDesc, srv) +func RegisterBlobberServer(s grpc.ServiceRegistrar, srv BlobberServer) { + s.RegisterService(&Blobber_ServiceDesc, srv) } func _Blobber_GetAllocation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -275,7 +290,28 @@ func _Blobber_GetObjectTree_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -var _Blobber_serviceDesc = grpc.ServiceDesc{ +func _Blobber_RenameObject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RenameObjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).RenameObject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/RenameObject", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).RenameObject(ctx, req.(*RenameObjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Blobber_ServiceDesc is the grpc.ServiceDesc for Blobber service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Blobber_ServiceDesc = grpc.ServiceDesc{ ServiceName: "blobber.service.v1.Blobber", HandlerType: (*BlobberServer)(nil), Methods: []grpc.MethodDesc{ @@ -307,6 +343,10 @@ var _Blobber_serviceDesc = grpc.ServiceDesc{ MethodName: "GetObjectTree", Handler: _Blobber_GetObjectTree_Handler, }, + { + MethodName: "RenameObject", + Handler: _Blobber_RenameObject_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "blobber.proto", diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto b/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto index e02cfbd76..ca00811e0 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto +++ b/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto @@ -42,6 +42,12 @@ service Blobber { get: "/v2/file/objecttree/{allocation}" }; } + rpc RenameObject(RenameObjectRequest) returns (RenameObjectResponse) { + option (google.api.http) = { + post: "/v1/file/rename/{allocation}" + body: "*" + }; + } } message GetObjectTreeRequest { @@ -166,6 +172,24 @@ message GetAllocationResponse { Allocation allocation = 1; } +message RenameObjectRequest { + string allocation = 1; + string path = 2; + string path_hash = 3; + string connection_id = 4; + string new_name = 5; +} +message RenameObjectResponse { + string filename = 1; + int64 size = 2; + string content_hash = 3; + string merkle_root = 4; + //UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer. + int64 upload_length = 5; + //Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer. + int64 upload_offset = 6; +} + message Allocation { string ID = 1; string Tx = 2; diff --git a/code/go/0chain.net/blobbercore/convert/responseHandler.go b/code/go/0chain.net/blobbercore/convert/responseHandler.go index e16a5177e..87ab4b79c 100644 --- a/code/go/0chain.net/blobbercore/convert/responseHandler.go +++ b/code/go/0chain.net/blobbercore/convert/responseHandler.go @@ -89,3 +89,14 @@ func GetObjectTreeResponseHandler(getObjectTreeResponse *blobbergrpc.GetObjectTr LatestWM: WriteMarkerGRPCToWriteMarker(getObjectTreeResponse.LatestWM), } } + +func RenameObjectResponseHandler(renameObjectResponse *blobbergrpc.RenameObjectResponse) *blobberHTTP.UploadResult { + return &blobberHTTP.UploadResult{ + Filename: renameObjectResponse.Filename, + Size: renameObjectResponse.Size, + Hash: renameObjectResponse.ContentHash, + MerkleRoot: renameObjectResponse.MerkleRoot, + UploadLength: renameObjectResponse.UploadLength, + UploadOffset: renameObjectResponse.UploadOffset, + } +} diff --git a/code/go/0chain.net/blobbercore/handler/handler.go b/code/go/0chain.net/blobbercore/handler/handler.go index 5d001aafc..ba50a0d59 100644 --- a/code/go/0chain.net/blobbercore/handler/handler.go +++ b/code/go/0chain.net/blobbercore/handler/handler.go @@ -39,7 +39,8 @@ func SetupHandlers(r *mux.Router) { //object operations r.HandleFunc("/v1/file/upload/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(UploadHandler)))) r.HandleFunc("/v1/file/download/{allocation}", common.UserRateLimit(common.ToByteStream(WithConnection(DownloadHandler)))) - r.HandleFunc("/v1/file/rename/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(RenameHandler)))) + r.HandleFunc("/v1/file/rename/{allocation}", common.UserRateLimit(common. + ToJSONResponse(WithConnection(RenameHandler(svc))))).Methods(http.MethodPost) r.HandleFunc("/v1/file/copy/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(CopyHandler)))) r.HandleFunc("/v1/file/attributes/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(UpdateAttributesHandler)))) @@ -289,14 +290,23 @@ func ObjectTreeHandler(svc *blobberGRPCService) func(ctx context.Context, r *htt } } -func RenameHandler(ctx context.Context, r *http.Request) (interface{}, error) { - ctx = setupHandlerContext(ctx, r) - response, err := storageHandler.RenameObject(ctx, r) - if err != nil { - return nil, err - } +func RenameHandler(svc *blobberGRPCService) func(ctx context.Context, r *http.Request) (interface{}, error) { + return func(ctx context.Context, r *http.Request) (interface{}, error) { + ctx = setupHandlerGRPCContext(ctx, r) - return response, nil + renameObjResponse, err := svc.RenameObject(ctx, &blobbergrpc.RenameObjectRequest{ + Allocation: mux.Vars(r)["allocation"], + Path: r.FormValue("path"), + PathHash: r.FormValue("path_hash"), + ConnectionId: r.FormValue("connection_id"), + NewName: r.FormValue("new_name"), + }) + if err != nil { + return nil, err + } + + return convert.RenameObjectResponseHandler(renameObjResponse), nil + } } func CopyHandler(ctx context.Context, r *http.Request) (interface{}, error) { diff --git a/code/go/0chain.net/blobbercore/handler/handler_test.go b/code/go/0chain.net/blobbercore/handler/handler_test.go index 0942083ee..400844ad4 100644 --- a/code/go/0chain.net/blobbercore/handler/handler_test.go +++ b/code/go/0chain.net/blobbercore/handler/handler_test.go @@ -140,7 +140,7 @@ func setupHandlers() (*mux.Router, map[string]string) { rName := "Rename" router.HandleFunc(rPath, common.UserRateLimit( common.ToJSONResponse( - WithReadOnlyConnection(RenameHandler), + WithReadOnlyConnection(RenameHandler(svc)), ), ), ).Name(rName) diff --git a/code/go/0chain.net/blobbercore/handler/helper.go b/code/go/0chain.net/blobbercore/handler/helper.go index d129bc7bd..41454c91d 100644 --- a/code/go/0chain.net/blobbercore/handler/helper.go +++ b/code/go/0chain.net/blobbercore/handler/helper.go @@ -30,6 +30,7 @@ type StorageHandlerI interface { // PackageHandler is an interface for all static functions that may need to be mocked type PackageHandler interface { + GetReferenceLookup(ctx context.Context, allocationID string, path string) string GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) GetCommitMetaTxns(ctx context.Context, refID int64) ([]reference.CommitMetaTxn, error) GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) @@ -39,6 +40,8 @@ type PackageHandler interface { GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) GetObjectPath(ctx context.Context, allocationID string, blockNum int64) (*reference.ObjectPath, error) GetReferencePathFromPaths(ctx context.Context, allocationID string, paths []string) (*reference.Ref, error) + GetAllocationChanges(ctx context.Context, connectionID string, + allocationID string, clientID string) (allocation.IAllocationChangeCollector, error) GetObjectTree(ctx context.Context, allocationID string, path string) (*reference.Ref, error) } @@ -68,6 +71,10 @@ func (r *packageHandler) GetWriteMarkerEntity(ctx context.Context, allocation_ro return writemarker.GetWriteMarkerEntity(ctx, allocation_root) } +func (r *packageHandler) GetReferenceLookup(ctx context.Context, allocationID string, path string) string { + return reference.GetReferenceLookup(allocationID, path) +} + func (r *packageHandler) GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) { return reference.GetReferenceFromLookupHash(ctx, allocationID, path_hash) } @@ -83,3 +90,9 @@ func (r *packageHandler) GetCollaborators(ctx context.Context, refID int64) ([]r func (r *packageHandler) IsACollaborator(ctx context.Context, refID int64, clientID string) bool { return reference.IsACollaborator(ctx, refID, clientID) } + +func (r *packageHandler) GetAllocationChanges(ctx context.Context, connectionID string, + allocationID string, clientID string) (allocation.IAllocationChangeCollector, error) { + + return allocation.GetAllocationChanges(ctx, connectionID, allocationID, clientID) +} diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go index abeebd162..ddbb09acd 100644 --- a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go +++ b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go @@ -1 +1,99 @@ package handler + +import ( + "context" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/lock" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" + "go.uber.org/zap" +) + +func (b *blobberGRPCService) RenameObject(ctx context.Context, r *blobbergrpc.RenameObjectRequest) ( + *blobbergrpc.RenameObjectResponse, error) { + + logger := ctxzap.Extract(ctx) + + allocationTx := r.Allocation + allocationObj, err := b.storageHandler.verifyAllocation(ctx, allocationTx, false) + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) + } + + md := GetGRPCMetaDataFromCtx(ctx) + valid, err := verifySignatureFromRequest(allocationTx, md.ClientSignature, allocationObj.OwnerPublicKey) + if !valid || err != nil { + return nil, common.NewError("invalid_signature", "Invalid signature") + } + + allocationID := allocationObj.ID + clientID := md.Client + + if len(clientID) == 0 { + return nil, common.NewError("invalid_operation", "Invalid client") + } + + if len(clientID) == 0 || allocationObj.OwnerID != clientID { + return nil, common. + NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + } + + newName := r.NewName + if len(newName) == 0 { + return nil, common.NewError("invalid_parameters", "Invalid name") + } + + pathHash := r.PathHash + path := r.Path + if len(pathHash) == 0 { + if len(path) == 0 { + return nil, common.NewError("invalid_parameters", "Invalid path") + } + pathHash = b.packageHandler.GetReferenceLookup(ctx, allocationObj.ID, path) + } + + connectionID := r.ConnectionId + if len(connectionID) == 0 { + return nil, common.NewError("invalid_parameters", "Invalid connection id passed") + } + + connectionObj, err := b.packageHandler.GetAllocationChanges(ctx, connectionID, allocationID, clientID) + if err != nil { + return nil, common.NewError("meta_error", "Error reading metadata for connection") + } + + mutex := lock.GetMutex(connectionObj.TableName(), connectionID) + mutex.Lock() + defer mutex.Unlock() + + objectRef, err := b.packageHandler.GetReferenceFromLookupHash(ctx, allocationID, pathHash) + + if err != nil { + return nil, common.NewError("invalid_parameters", "Invalid file path. "+err.Error()) + } + + allocationChange := &allocation.AllocationChange{} + allocationChange.ConnectionID = connectionObj.GetConnectionID() + allocationChange.Size = 0 + allocationChange.Operation = allocation.RENAME_OPERATION + dfc := &allocation.RenameFileChange{ConnectionID: connectionObj.GetConnectionID(), + AllocationID: connectionObj.GetAllocationID(), Path: objectRef.Path} + dfc.NewName = newName + connectionObj.SetSize(connectionObj.GetSize() + allocationChange.Size) + connectionObj.AddChange(allocationChange, dfc) + + err = connectionObj.Save(ctx) + if err != nil { + logger.Error("Error in writing the connection meta data", zap.Error(err)) + return nil, common.NewError("connection_write_error", "Error writing the connection meta data") + } + + result := &blobbergrpc.RenameObjectResponse{} + result.Filename = newName + result.ContentHash = objectRef.Hash + result.MerkleRoot = objectRef.MerkleRoot + result.Size = objectRef.Size + + return result, nil +} diff --git a/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json b/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json index bb3789a42..cbc38e476 100644 --- a/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json +++ b/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json @@ -16,6 +16,44 @@ "application/json" ], "paths": { + "/v1/file/rename/{allocation}": { + "post": { + "operationId": "Blobber_RenameObject", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1RenameObjectResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1RenameObjectRequest" + } + } + ], + "tags": [ + "Blobber" + ] + } + }, "/v2/allocation": { "get": { "operationId": "Blobber_GetAllocation", @@ -738,6 +776,54 @@ } } }, + "v1RenameObjectRequest": { + "type": "object", + "properties": { + "allocation": { + "type": "string" + }, + "path": { + "type": "string" + }, + "pathHash": { + "type": "string" + }, + "connectionId": { + "type": "string" + }, + "newName": { + "type": "string" + } + } + }, + "v1RenameObjectResponse": { + "type": "object", + "properties": { + "filename": { + "type": "string" + }, + "size": { + "type": "string", + "format": "int64" + }, + "contentHash": { + "type": "string" + }, + "merkleRoot": { + "type": "string" + }, + "uploadLength": { + "type": "string", + "format": "int64", + "description": "UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer." + }, + "uploadOffset": { + "type": "string", + "format": "int64", + "description": "Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer." + } + } + }, "v1Term": { "type": "object", "properties": { From 77dda14188a645e70cc31ee2c795bd0f6df1ee8c Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Wed, 26 May 2021 14:46:49 +0530 Subject: [PATCH 02/11] rename object handler grpc tests added --- .../object_operation_grpc_handler_test.go | 111 ++++++++++++++++++ .../blobbercore/mocks/PackageHandler.go | 41 ++++++- 2 files changed, 151 insertions(+), 1 deletion(-) diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go index abeebd162..8254d47f2 100644 --- a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go +++ b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go @@ -1 +1,112 @@ package handler + +import ( + "context" + "errors" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/mocks" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "google.golang.org/grpc/metadata" + "testing" +) + +func TestBlobberGRPCService_RenameObject_Success(t *testing.T) { + allocationTx := randString(32) + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + req := &blobbergrpc.RenameObjectRequest{ + Allocation: allocationTx, + Path: `path`, + ConnectionId: `connection_id`, + NewName: `new_name`, + } + + ctx := metadata.NewIncomingContext(context.Background(), metadata.New(map[string]string{ + common.ClientHeader: "client", + common.ClientKeyHeader: "client_key", + common.ClientSignatureHeader: clientSignature, + })) + + mockStorageHandler := &storageHandlerI{} + alloc := &allocation.Allocation{ + Tx: req.Allocation, + ID: `allocation_id`, + OwnerID: `client`, + OwnerPublicKey: pubKey, + } + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false). + Return(alloc, nil) + + mockAllocCollector := &mocks.IAllocationChangeCollector{} + mockAllocCollector.On(`GetConnectionID`).Return(req.ConnectionId) + mockAllocCollector.On(`GetAllocationID`).Return(req.Allocation) + mockAllocCollector.On(`SetSize`, mock.Anything).Return() + mockAllocCollector.On(`GetSize`).Return(int64(1)) + mockAllocCollector.On(`AddChange`, mock.Anything, mock.Anything).Return() + mockAllocCollector.On(`Save`, mock.Anything).Return(nil) + mockAllocCollector.On(`TableName`).Return(`allocation_connections`) + + mockReferencePackage := &mocks.PackageHandler{} + mockReferencePackage.On(`GetAllocationChanges`, mock.Anything, + req.ConnectionId, alloc.ID, `client`).Return(mockAllocCollector, nil) + + pathHash := req.Allocation + `:` + req.Path + mockReferencePackage.On(`GetReferenceLookup`, mock.Anything, alloc.ID, req.Path). + Return(pathHash) + objectRef := &reference.Ref{ + Name: "test", + ContentHash: `hash`, + MerkleRoot: `root`, + Size: 1, + } + mockReferencePackage.On(`GetReferenceFromLookupHash`, mock.Anything, alloc.ID, pathHash). + Return(objectRef, nil) + + resOk := &blobbergrpc.RenameObjectResponse{ + Filename: req.NewName, + Size: objectRef.Size, + ContentHash: objectRef.Hash, + MerkleRoot: objectRef.MerkleRoot, + UploadLength: 0, + UploadOffset: 0, + } + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + gotResponse, err := svc.RenameObject(ctx, req) + if err != nil { + t.Fatal("unexpected error - " + err.Error()) + } + + assert.Equal(t, gotResponse, resOk) +} + +func TestBlobberGRPCService_RenameObject_InvalidAllocation(t *testing.T) { + req := &blobbergrpc.RenameObjectRequest{ + Allocation: `invalid_allocation`, + } + ctx := metadata.NewIncomingContext(context.Background(), metadata.New(map[string]string{ + common.ClientHeader: "client", + common.ClientKeyHeader: "client_key", + common.ClientSignatureHeader: "clientSignature", + })) + + mockStorageHandler := &storageHandlerI{} + mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false). + Return(nil, errors.New("some error")) + + mockReferencePackage := &mocks.PackageHandler{} + + svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) + _, err := svc.RenameObject(ctx, req) + if err == nil { + t.Fatal("expected error") + } + if err.Error() != "invalid_parameters: Invalid allocation id passed.some error" { + t.Fatal(`unexpected error - `, err) + } +} diff --git a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go index 73c3dd36f..2c3d4c11c 100644 --- a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go +++ b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go @@ -1,10 +1,12 @@ -// Code generated by mockery v0.0.0-dev. DO NOT EDIT. +// Code generated by mockery 2.7.5. DO NOT EDIT. package mocks import ( context "context" + allocation "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + mock "github.com/stretchr/testify/mock" reference "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" @@ -19,6 +21,29 @@ type PackageHandler struct { mock.Mock } +// GetAllocationChanges provides a mock function with given fields: ctx, connectionID, allocationID, clientID +func (_m *PackageHandler) GetAllocationChanges(ctx context.Context, connectionID string, allocationID string, clientID string) (allocation.IAllocationChangeCollector, error) { + ret := _m.Called(ctx, connectionID, allocationID, clientID) + + var r0 allocation.IAllocationChangeCollector + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) allocation.IAllocationChangeCollector); ok { + r0 = rf(ctx, connectionID, allocationID, clientID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(allocation.IAllocationChangeCollector) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { + r1 = rf(ctx, connectionID, allocationID, clientID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetCollaborators provides a mock function with given fields: ctx, refID func (_m *PackageHandler) GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) { ret := _m.Called(ctx, refID) @@ -180,6 +205,20 @@ func (_m *PackageHandler) GetReferenceFromLookupHash(ctx context.Context, alloca return r0, r1 } +// GetReferenceLookup provides a mock function with given fields: ctx, allocationID, path +func (_m *PackageHandler) GetReferenceLookup(ctx context.Context, allocationID string, path string) string { + ret := _m.Called(ctx, allocationID, path) + + var r0 string + if rf, ok := ret.Get(0).(func(context.Context, string, string) string); ok { + r0 = rf(ctx, allocationID, path) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + // GetReferencePathFromPaths provides a mock function with given fields: ctx, allocationID, paths func (_m *PackageHandler) GetReferencePathFromPaths(ctx context.Context, allocationID string, paths []string) (*reference.Ref, error) { ret := _m.Called(ctx, allocationID, paths) From efa819e21c1a12a6ed4650f76b5017623d77cbd0 Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Sun, 30 May 2021 20:55:42 +0530 Subject: [PATCH 03/11] workflow updated for pull requests --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e913f0ba..f68d4fa2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,9 @@ on: release: types: - published - + pull_request: + paths-ignore: + - '**.md' env: BLOBBER_REGISTRY: ${{ secrets.BLOBBER_REGISTRY }} VALIDATOR_REGISTRY: ${{ secrets.VALIDATOR_REGISTRY }} From 34ca01792f93ca30edcaf5758d8482823e39834f Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Sun, 30 May 2021 22:12:22 +0530 Subject: [PATCH 04/11] proto versions mismatch fixed --- .../0chain.net/blobbercore/blobbergrpc/blobber.pb.go | 2 +- .../blobbercore/blobbergrpc/blobber_grpc.pb.go | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go index 972d362a3..e6186cb43 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.17.0 +// protoc v3.6.1 // source: blobber.proto package blobbergrpc diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go index 126b9e98c..3e872cfa7 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go @@ -11,7 +11,6 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // BlobberClient is the client API for Blobber service. @@ -160,8 +159,8 @@ type UnsafeBlobberServer interface { mustEmbedUnimplementedBlobberServer() } -func RegisterBlobberServer(s grpc.ServiceRegistrar, srv BlobberServer) { - s.RegisterService(&Blobber_ServiceDesc, srv) +func RegisterBlobberServer(s *grpc.Server, srv BlobberServer) { + s.RegisterService(&_Blobber_serviceDesc, srv) } func _Blobber_GetAllocation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -308,10 +307,7 @@ func _Blobber_RenameObject_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -// Blobber_ServiceDesc is the grpc.ServiceDesc for Blobber service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Blobber_ServiceDesc = grpc.ServiceDesc{ +var _Blobber_serviceDesc = grpc.ServiceDesc{ ServiceName: "blobber.service.v1.Blobber", HandlerType: (*BlobberServer)(nil), Methods: []grpc.MethodDesc{ From 13ee27cdd40b645ad1e1818d1bf374a372d7be91 Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Mon, 31 May 2021 19:24:32 +0530 Subject: [PATCH 05/11] go lint timeout updated --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ef5d2f84d..dc1cdf24d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ test: go test ./...; lint: - golangci-lint run; + golangci-lint run --timeout 2m0s; integration-tests: go test ./... -args integration; \ No newline at end of file From 5e3242c185bbf56a04699408c7e381cc7dfb6911 Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Tue, 1 Jun 2021 22:45:35 +0530 Subject: [PATCH 06/11] reviews applied --- .../allocation/allocationchange.go | 35 ----- .../0chain.net/blobbercore/handler/handler.go | 3 +- .../0chain.net/blobbercore/handler/helper.go | 10 +- .../handler/object_operation_grpc_handler.go | 24 ++- ...operation_grpc_handler_integration_test.go | 1 - .../object_operation_grpc_handler_test.go | 14 +- .../mocks/IAllocationChangeCollector.go | 148 ------------------ .../blobbercore/mocks/PackageHandler.go | 22 ++- 8 files changed, 41 insertions(+), 216 deletions(-) delete mode 100644 code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_integration_test.go delete mode 100644 code/go/0chain.net/blobbercore/mocks/IAllocationChangeCollector.go diff --git a/code/go/0chain.net/blobbercore/allocation/allocationchange.go b/code/go/0chain.net/blobbercore/allocation/allocationchange.go index 967be49be..09c124885 100644 --- a/code/go/0chain.net/blobbercore/allocation/allocationchange.go +++ b/code/go/0chain.net/blobbercore/allocation/allocationchange.go @@ -39,21 +39,6 @@ type AllocationChangeProcessor interface { Unmarshal(string) error } -type IAllocationChangeCollector interface { - TableName() string - AddChange(allocationChange *AllocationChange, changeProcessor AllocationChangeProcessor) - Save(ctx context.Context) error - ComputeProperties() - ApplyChanges(ctx context.Context, allocationRoot string) error - CommitToFileStore(ctx context.Context) error - DeleteChanges(ctx context.Context) - GetAllocationID() string - GetConnectionID() string - GetClientID() string - GetSize() int64 - SetSize(size int64) -} - type AllocationChangeCollector struct { ConnectionID string `gorm:"column:connection_id;primary_key"` AllocationID string `gorm:"column:allocation_id"` @@ -185,23 +170,3 @@ func (a *AllocationChangeCollector) DeleteChanges(ctx context.Context) { } } } - -func (cc *AllocationChangeCollector) GetAllocationID() string { - return cc.AllocationID -} - -func (cc *AllocationChangeCollector) GetConnectionID() string { - return cc.ConnectionID -} - -func (cc *AllocationChangeCollector) GetClientID() string { - return cc.ClientID -} - -func (cc *AllocationChangeCollector) GetSize() int64 { - return cc.Size -} - -func (cc *AllocationChangeCollector) SetSize(size int64) { - cc.Size = size -} diff --git a/code/go/0chain.net/blobbercore/handler/handler.go b/code/go/0chain.net/blobbercore/handler/handler.go index ba50a0d59..19f2ccb20 100644 --- a/code/go/0chain.net/blobbercore/handler/handler.go +++ b/code/go/0chain.net/blobbercore/handler/handler.go @@ -39,8 +39,7 @@ func SetupHandlers(r *mux.Router) { //object operations r.HandleFunc("/v1/file/upload/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(UploadHandler)))) r.HandleFunc("/v1/file/download/{allocation}", common.UserRateLimit(common.ToByteStream(WithConnection(DownloadHandler)))) - r.HandleFunc("/v1/file/rename/{allocation}", common.UserRateLimit(common. - ToJSONResponse(WithConnection(RenameHandler(svc))))).Methods(http.MethodPost) + r.HandleFunc("/v1/file/rename/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(RenameHandler(svc))))).Methods(http.MethodPost) r.HandleFunc("/v1/file/copy/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(CopyHandler)))) r.HandleFunc("/v1/file/attributes/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(UpdateAttributesHandler)))) diff --git a/code/go/0chain.net/blobbercore/handler/helper.go b/code/go/0chain.net/blobbercore/handler/helper.go index 41454c91d..320f1e92d 100644 --- a/code/go/0chain.net/blobbercore/handler/helper.go +++ b/code/go/0chain.net/blobbercore/handler/helper.go @@ -40,8 +40,8 @@ type PackageHandler interface { GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) GetObjectPath(ctx context.Context, allocationID string, blockNum int64) (*reference.ObjectPath, error) GetReferencePathFromPaths(ctx context.Context, allocationID string, paths []string) (*reference.Ref, error) - GetAllocationChanges(ctx context.Context, connectionID string, - allocationID string, clientID string) (allocation.IAllocationChangeCollector, error) + GetAllocationChanges(ctx context.Context, connectionID string, allocationID string, clientID string) (*allocation.AllocationChangeCollector, error) + SaveAllocationChanges(ctx context.Context, alloc *allocation.AllocationChangeCollector) error GetObjectTree(ctx context.Context, allocationID string, path string) (*reference.Ref, error) } @@ -92,7 +92,11 @@ func (r *packageHandler) IsACollaborator(ctx context.Context, refID int64, clien } func (r *packageHandler) GetAllocationChanges(ctx context.Context, connectionID string, - allocationID string, clientID string) (allocation.IAllocationChangeCollector, error) { + allocationID string, clientID string) (*allocation.AllocationChangeCollector, error) { return allocation.GetAllocationChanges(ctx, connectionID, allocationID, clientID) } + +func (r packageHandler) SaveAllocationChanges(ctx context.Context, alloc *allocation.AllocationChangeCollector) error { + return alloc.Save(ctx) +} diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go index ddbb09acd..b6229158b 100644 --- a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go +++ b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go @@ -10,9 +10,7 @@ import ( "go.uber.org/zap" ) -func (b *blobberGRPCService) RenameObject(ctx context.Context, r *blobbergrpc.RenameObjectRequest) ( - *blobbergrpc.RenameObjectResponse, error) { - +func (b *blobberGRPCService) RenameObject(ctx context.Context, r *blobbergrpc.RenameObjectRequest) (*blobbergrpc.RenameObjectResponse, error) { logger := ctxzap.Extract(ctx) allocationTx := r.Allocation @@ -34,11 +32,6 @@ func (b *blobberGRPCService) RenameObject(ctx context.Context, r *blobbergrpc.Re return nil, common.NewError("invalid_operation", "Invalid client") } - if len(clientID) == 0 || allocationObj.OwnerID != clientID { - return nil, common. - NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") - } - newName := r.NewName if len(newName) == 0 { return nil, common.NewError("invalid_parameters", "Invalid name") @@ -53,6 +46,11 @@ func (b *blobberGRPCService) RenameObject(ctx context.Context, r *blobbergrpc.Re pathHash = b.packageHandler.GetReferenceLookup(ctx, allocationObj.ID, path) } + if len(clientID) == 0 || allocationObj.OwnerID != clientID { + return nil, common. + NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + } + connectionID := r.ConnectionId if len(connectionID) == 0 { return nil, common.NewError("invalid_parameters", "Invalid connection id passed") @@ -74,16 +72,16 @@ func (b *blobberGRPCService) RenameObject(ctx context.Context, r *blobbergrpc.Re } allocationChange := &allocation.AllocationChange{} - allocationChange.ConnectionID = connectionObj.GetConnectionID() + allocationChange.ConnectionID = connectionObj.ConnectionID allocationChange.Size = 0 allocationChange.Operation = allocation.RENAME_OPERATION - dfc := &allocation.RenameFileChange{ConnectionID: connectionObj.GetConnectionID(), - AllocationID: connectionObj.GetAllocationID(), Path: objectRef.Path} + dfc := &allocation.RenameFileChange{ConnectionID: connectionObj.ConnectionID, + AllocationID: connectionObj.AllocationID, Path: objectRef.Path} dfc.NewName = newName - connectionObj.SetSize(connectionObj.GetSize() + allocationChange.Size) + connectionObj.Size += allocationChange.Size connectionObj.AddChange(allocationChange, dfc) - err = connectionObj.Save(ctx) + err = b.packageHandler.SaveAllocationChanges(ctx, connectionObj) if err != nil { logger.Error("Error in writing the connection meta data", zap.Error(err)) return nil, common.NewError("connection_write_error", "Error writing the connection meta data") diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_integration_test.go b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_integration_test.go deleted file mode 100644 index abeebd162..000000000 --- a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_integration_test.go +++ /dev/null @@ -1 +0,0 @@ -package handler diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go index 8254d47f2..545b80571 100644 --- a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go +++ b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go @@ -42,18 +42,12 @@ func TestBlobberGRPCService_RenameObject_Success(t *testing.T) { mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false). Return(alloc, nil) - mockAllocCollector := &mocks.IAllocationChangeCollector{} - mockAllocCollector.On(`GetConnectionID`).Return(req.ConnectionId) - mockAllocCollector.On(`GetAllocationID`).Return(req.Allocation) - mockAllocCollector.On(`SetSize`, mock.Anything).Return() - mockAllocCollector.On(`GetSize`).Return(int64(1)) - mockAllocCollector.On(`AddChange`, mock.Anything, mock.Anything).Return() - mockAllocCollector.On(`Save`, mock.Anything).Return(nil) - mockAllocCollector.On(`TableName`).Return(`allocation_connections`) - mockReferencePackage := &mocks.PackageHandler{} + allocChange := &allocation.AllocationChangeCollector{} mockReferencePackage.On(`GetAllocationChanges`, mock.Anything, - req.ConnectionId, alloc.ID, `client`).Return(mockAllocCollector, nil) + req.ConnectionId, alloc.ID, `client`).Return(allocChange, nil) + mockReferencePackage.On(`SaveAllocationChanges`, mock.Anything, allocChange). + Return(nil) pathHash := req.Allocation + `:` + req.Path mockReferencePackage.On(`GetReferenceLookup`, mock.Anything, alloc.ID, req.Path). diff --git a/code/go/0chain.net/blobbercore/mocks/IAllocationChangeCollector.go b/code/go/0chain.net/blobbercore/mocks/IAllocationChangeCollector.go deleted file mode 100644 index 37556727b..000000000 --- a/code/go/0chain.net/blobbercore/mocks/IAllocationChangeCollector.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by mockery 2.7.5. DO NOT EDIT. - -package mocks - -import ( - context "context" - - allocation "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" - - mock "github.com/stretchr/testify/mock" -) - -// IAllocationChangeCollector is an autogenerated mock type for the IAllocationChangeCollector type -type IAllocationChangeCollector struct { - mock.Mock -} - -// AddChange provides a mock function with given fields: allocationChange, changeProcessor -func (_m *IAllocationChangeCollector) AddChange(allocationChange *allocation.AllocationChange, changeProcessor allocation.AllocationChangeProcessor) { - _m.Called(allocationChange, changeProcessor) -} - -// ApplyChanges provides a mock function with given fields: ctx, allocationRoot -func (_m *IAllocationChangeCollector) ApplyChanges(ctx context.Context, allocationRoot string) error { - ret := _m.Called(ctx, allocationRoot) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { - r0 = rf(ctx, allocationRoot) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// CommitToFileStore provides a mock function with given fields: ctx -func (_m *IAllocationChangeCollector) CommitToFileStore(ctx context.Context) error { - ret := _m.Called(ctx) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context) error); ok { - r0 = rf(ctx) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ComputeProperties provides a mock function with given fields: -func (_m *IAllocationChangeCollector) ComputeProperties() { - _m.Called() -} - -// DeleteChanges provides a mock function with given fields: ctx -func (_m *IAllocationChangeCollector) DeleteChanges(ctx context.Context) { - _m.Called(ctx) -} - -// GetAllocationID provides a mock function with given fields: -func (_m *IAllocationChangeCollector) GetAllocationID() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// GetClientID provides a mock function with given fields: -func (_m *IAllocationChangeCollector) GetClientID() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// GetConnectionID provides a mock function with given fields: -func (_m *IAllocationChangeCollector) GetConnectionID() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// GetSize provides a mock function with given fields: -func (_m *IAllocationChangeCollector) GetSize() int64 { - ret := _m.Called() - - var r0 int64 - if rf, ok := ret.Get(0).(func() int64); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(int64) - } - - return r0 -} - -// Save provides a mock function with given fields: ctx -func (_m *IAllocationChangeCollector) Save(ctx context.Context) error { - ret := _m.Called(ctx) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context) error); ok { - r0 = rf(ctx) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SetSize provides a mock function with given fields: size -func (_m *IAllocationChangeCollector) SetSize(size int64) { - _m.Called(size) -} - -// TableName provides a mock function with given fields: -func (_m *IAllocationChangeCollector) TableName() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} diff --git a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go index 2c3d4c11c..1194a52a0 100644 --- a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go +++ b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go @@ -22,15 +22,15 @@ type PackageHandler struct { } // GetAllocationChanges provides a mock function with given fields: ctx, connectionID, allocationID, clientID -func (_m *PackageHandler) GetAllocationChanges(ctx context.Context, connectionID string, allocationID string, clientID string) (allocation.IAllocationChangeCollector, error) { +func (_m *PackageHandler) GetAllocationChanges(ctx context.Context, connectionID string, allocationID string, clientID string) (*allocation.AllocationChangeCollector, error) { ret := _m.Called(ctx, connectionID, allocationID, clientID) - var r0 allocation.IAllocationChangeCollector - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) allocation.IAllocationChangeCollector); ok { + var r0 *allocation.AllocationChangeCollector + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *allocation.AllocationChangeCollector); ok { r0 = rf(ctx, connectionID, allocationID, clientID) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(allocation.IAllocationChangeCollector) + r0 = ret.Get(0).(*allocation.AllocationChangeCollector) } } @@ -278,3 +278,17 @@ func (_m *PackageHandler) IsACollaborator(ctx context.Context, refID int64, clie return r0 } + +// SaveAllocationChanges provides a mock function with given fields: ctx, alloc +func (_m *PackageHandler) SaveAllocationChanges(ctx context.Context, alloc *allocation.AllocationChangeCollector) error { + ret := _m.Called(ctx, alloc) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *allocation.AllocationChangeCollector) error); ok { + r0 = rf(ctx, alloc) + } else { + r0 = ret.Error(0) + } + + return r0 +} From e5984e8c7ca1a66eeec5bcc2ad860aad36ede1a5 Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Tue, 1 Jun 2021 22:47:49 +0530 Subject: [PATCH 07/11] endpoint version updated --- .../blobbercore/blobbergrpc/blobber.pb.go | 2 +- .../blobbercore/blobbergrpc/blobber.pb.gw.go | 2 +- .../blobbergrpc/proto/blobber.proto | 2 +- .../blobbercore/openapi/blobber.swagger.json | 76 +++++++++---------- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go index e6186cb43..f2e6be34a 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go @@ -2566,7 +2566,7 @@ var file_blobber_proto_rawDesc = []byte{ 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x72, 0x65, + 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x42, 0x2c, 0x5a, 0x2a, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x6f, 0x2f, 0x30, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go index 8516e3e02..1e004b759 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go @@ -964,7 +964,7 @@ var ( pattern_Blobber_GetObjectTree_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "objecttree", "allocation"}, "")) - pattern_Blobber_RenameObject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "file", "rename", "allocation"}, "")) + pattern_Blobber_RenameObject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "rename", "allocation"}, "")) ) var ( diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto b/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto index ca00811e0..726e72317 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto +++ b/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto @@ -44,7 +44,7 @@ service Blobber { } rpc RenameObject(RenameObjectRequest) returns (RenameObjectResponse) { option (google.api.http) = { - post: "/v1/file/rename/{allocation}" + post: "/v2/file/rename/{allocation}" body: "*" }; } diff --git a/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json b/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json index cbc38e476..9940fc247 100644 --- a/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json +++ b/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json @@ -16,44 +16,6 @@ "application/json" ], "paths": { - "/v1/file/rename/{allocation}": { - "post": { - "operationId": "Blobber_RenameObject", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1RenameObjectResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "allocation", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1RenameObjectRequest" - } - } - ], - "tags": [ - "Blobber" - ] - } - }, "/v2/allocation": { "get": { "operationId": "Blobber_GetAllocation", @@ -300,6 +262,44 @@ ] } }, + "/v2/file/rename/{allocation}": { + "post": { + "operationId": "Blobber_RenameObject", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1RenameObjectResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1RenameObjectRequest" + } + } + ], + "tags": [ + "Blobber" + ] + } + }, "/v2/file/stats/{allocation}": { "get": { "operationId": "Blobber_GetFileStats", From 7603fb49e37029e7c4b9c606b99917c5cfac8ec4 Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Sat, 5 Jun 2021 21:41:24 +0530 Subject: [PATCH 08/11] 156 conflicts resolved with grpc --- .../blobbercore/blobbergrpc/blobber.pb.go | 200 ++++----- .../blobbercore/blobbergrpc/blobber.pb.gw.go | 120 +++--- .../blobbergrpc/blobber_grpc.pb.go | 36 +- .../0chain.net/blobbercore/handler/helper.go | 7 - .../blobbercore/mocks/PackageHandler.go | 396 ------------------ 5 files changed, 184 insertions(+), 575 deletions(-) delete mode 100644 code/go/0chain.net/blobbercore/mocks/PackageHandler.go diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go index e8591b1a8..85fda4e42 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go @@ -1706,7 +1706,7 @@ type RenameObjectRequest struct { func (x *RenameObjectRequest) Reset() { *x = RenameObjectRequest{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[20] + mi := &file_blobber_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1719,7 +1719,7 @@ func (x *RenameObjectRequest) String() string { func (*RenameObjectRequest) ProtoMessage() {} func (x *RenameObjectRequest) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[20] + mi := &file_blobber_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1732,7 +1732,7 @@ func (x *RenameObjectRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RenameObjectRequest.ProtoReflect.Descriptor instead. func (*RenameObjectRequest) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{20} + return file_blobber_proto_rawDescGZIP(), []int{26} } func (x *RenameObjectRequest) GetAllocation() string { @@ -1788,7 +1788,7 @@ type RenameObjectResponse struct { func (x *RenameObjectResponse) Reset() { *x = RenameObjectResponse{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[21] + mi := &file_blobber_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1801,7 +1801,7 @@ func (x *RenameObjectResponse) String() string { func (*RenameObjectResponse) ProtoMessage() {} func (x *RenameObjectResponse) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[21] + mi := &file_blobber_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1814,7 +1814,7 @@ func (x *RenameObjectResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RenameObjectResponse.ProtoReflect.Descriptor instead. func (*RenameObjectResponse) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{21} + return file_blobber_proto_rawDescGZIP(), []int{27} } func (x *RenameObjectResponse) GetFilename() string { @@ -1886,7 +1886,7 @@ type Allocation struct { func (x *Allocation) Reset() { *x = Allocation{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[26] + mi := &file_blobber_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1899,7 +1899,7 @@ func (x *Allocation) String() string { func (*Allocation) ProtoMessage() {} func (x *Allocation) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[26] + mi := &file_blobber_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1912,7 +1912,7 @@ func (x *Allocation) ProtoReflect() protoreflect.Message { // Deprecated: Use Allocation.ProtoReflect.Descriptor instead. func (*Allocation) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{26} + return file_blobber_proto_rawDescGZIP(), []int{28} } func (x *Allocation) GetID() string { @@ -2049,7 +2049,7 @@ type Term struct { func (x *Term) Reset() { *x = Term{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[27] + mi := &file_blobber_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2062,7 +2062,7 @@ func (x *Term) String() string { func (*Term) ProtoMessage() {} func (x *Term) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[27] + mi := &file_blobber_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2075,7 +2075,7 @@ func (x *Term) ProtoReflect() protoreflect.Message { // Deprecated: Use Term.ProtoReflect.Descriptor instead. func (*Term) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{27} + return file_blobber_proto_rawDescGZIP(), []int{29} } func (x *Term) GetID() int64 { @@ -2126,7 +2126,7 @@ type FileRef struct { func (x *FileRef) Reset() { *x = FileRef{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[28] + mi := &file_blobber_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2139,7 +2139,7 @@ func (x *FileRef) String() string { func (*FileRef) ProtoMessage() {} func (x *FileRef) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[28] + mi := &file_blobber_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2152,7 +2152,7 @@ func (x *FileRef) ProtoReflect() protoreflect.Message { // Deprecated: Use FileRef.ProtoReflect.Descriptor instead. func (*FileRef) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{28} + return file_blobber_proto_rawDescGZIP(), []int{30} } func (x *FileRef) GetType() string { @@ -2210,7 +2210,7 @@ type FileMetaData struct { func (x *FileMetaData) Reset() { *x = FileMetaData{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[29] + mi := &file_blobber_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2223,7 +2223,7 @@ func (x *FileMetaData) String() string { func (*FileMetaData) ProtoMessage() {} func (x *FileMetaData) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[29] + mi := &file_blobber_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2236,7 +2236,7 @@ func (x *FileMetaData) ProtoReflect() protoreflect.Message { // Deprecated: Use FileMetaData.ProtoReflect.Descriptor instead. func (*FileMetaData) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{29} + return file_blobber_proto_rawDescGZIP(), []int{31} } func (x *FileMetaData) GetType() string { @@ -2427,7 +2427,7 @@ type DirMetaData struct { func (x *DirMetaData) Reset() { *x = DirMetaData{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[30] + mi := &file_blobber_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2440,7 +2440,7 @@ func (x *DirMetaData) String() string { func (*DirMetaData) ProtoMessage() {} func (x *DirMetaData) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[30] + mi := &file_blobber_proto_msgTypes[32] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2453,7 +2453,7 @@ func (x *DirMetaData) ProtoReflect() protoreflect.Message { // Deprecated: Use DirMetaData.ProtoReflect.Descriptor instead. func (*DirMetaData) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{30} + return file_blobber_proto_rawDescGZIP(), []int{32} } func (x *DirMetaData) GetType() string { @@ -2908,7 +2908,7 @@ var file_blobber_proto_rawDesc = []byte{ 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x32, 0x96, 0x0b, 0x0a, + 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x32, 0xa3, 0x0c, 0x0a, 0x07, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x12, 0x7c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, @@ -2971,37 +2971,46 @@ var file_blobber_proto_rawDesc = []byte{ 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x74, 0x72, 0x65, 0x65, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x7e, 0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x12, 0x21, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, - 0x22, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x94, 0x01, 0x0a, 0x0d, 0x43, 0x61, 0x6c, 0x63, - 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, - 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, - 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, - 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, - 0x2f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x68, 0x61, 0x73, 0x68, 0x2f, 0x7b, - 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x94, - 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, - 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, - 0x54, 0x78, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, - 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, - 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, - 0x74, 0x61, 0x74, 0x78, 0x6e, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x42, 0x2c, 0x5a, 0x2a, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x6f, - 0x2f, 0x30, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x62, 0x6c, 0x6f, 0x62, - 0x62, 0x65, 0x72, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x67, - 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x8a, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x6e, 0x61, + 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x72, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x7e, 0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, + 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x22, 0x22, 0x2f, + 0x76, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x94, 0x01, 0x0a, 0x0d, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, + 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x63, + 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, + 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x61, + 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x68, 0x61, 0x73, 0x68, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x94, 0x01, 0x0a, 0x0d, + 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x12, 0x28, 0x2e, + 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, + 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, 0x76, 0x32, 0x2f, + 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x74, 0x61, 0x74, + 0x78, 0x6e, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, + 0x01, 0x2a, 0x42, 0x2c, 0x5a, 0x2a, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x6f, 0x2f, 0x30, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x67, 0x72, 0x70, 0x63, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3016,7 +3025,7 @@ func file_blobber_proto_rawDescGZIP() []byte { return file_blobber_proto_rawDescData } -var file_blobber_proto_msgTypes = make([]protoimpl.MessageInfo, 31) +var file_blobber_proto_msgTypes = make([]protoimpl.MessageInfo, 33) var file_blobber_proto_goTypes = []interface{}{ (*CalculateHashRequest)(nil), // 0: blobber.service.v1.CalculateHashRequest (*CalculateHashResponse)(nil), // 1: blobber.service.v1.CalculateHashResponse @@ -3044,11 +3053,13 @@ var file_blobber_proto_goTypes = []interface{}{ (*Collaborator)(nil), // 23: blobber.service.v1.Collaborator (*GetAllocationRequest)(nil), // 24: blobber.service.v1.GetAllocationRequest (*GetAllocationResponse)(nil), // 25: blobber.service.v1.GetAllocationResponse - (*Allocation)(nil), // 26: blobber.service.v1.Allocation - (*Term)(nil), // 27: blobber.service.v1.Term - (*FileRef)(nil), // 28: blobber.service.v1.FileRef - (*FileMetaData)(nil), // 29: blobber.service.v1.FileMetaData - (*DirMetaData)(nil), // 30: blobber.service.v1.DirMetaData + (*RenameObjectRequest)(nil), // 26: blobber.service.v1.RenameObjectRequest + (*RenameObjectResponse)(nil), // 27: blobber.service.v1.RenameObjectResponse + (*Allocation)(nil), // 28: blobber.service.v1.Allocation + (*Term)(nil), // 29: blobber.service.v1.Term + (*FileRef)(nil), // 30: blobber.service.v1.FileRef + (*FileMetaData)(nil), // 31: blobber.service.v1.FileMetaData + (*DirMetaData)(nil), // 32: blobber.service.v1.DirMetaData } var file_blobber_proto_depIdxs = []int32{ 14, // 0: blobber.service.v1.CommitResponse.write_marker:type_name -> blobber.service.v1.WriteMarker @@ -3056,23 +3067,23 @@ var file_blobber_proto_depIdxs = []int32{ 14, // 2: blobber.service.v1.GetObjectTreeResponse.LatestWM:type_name -> blobber.service.v1.WriteMarker 10, // 3: blobber.service.v1.GetReferencePathResponse.ReferencePath:type_name -> blobber.service.v1.ReferencePath 14, // 4: blobber.service.v1.GetReferencePathResponse.LatestWM:type_name -> blobber.service.v1.WriteMarker - 28, // 5: blobber.service.v1.ReferencePath.MetaData:type_name -> blobber.service.v1.FileRef + 30, // 5: blobber.service.v1.ReferencePath.MetaData:type_name -> blobber.service.v1.FileRef 10, // 6: blobber.service.v1.ReferencePath.List:type_name -> blobber.service.v1.ReferencePath 13, // 7: blobber.service.v1.GetObjectPathResponse.ObjectPath:type_name -> blobber.service.v1.ObjectPath 14, // 8: blobber.service.v1.GetObjectPathResponse.LatestWriteMarker:type_name -> blobber.service.v1.WriteMarker - 28, // 9: blobber.service.v1.ObjectPath.Meta:type_name -> blobber.service.v1.FileRef - 28, // 10: blobber.service.v1.ObjectPath.Path:type_name -> blobber.service.v1.FileRef - 28, // 11: blobber.service.v1.ObjectPath.PathList:type_name -> blobber.service.v1.FileRef - 28, // 12: blobber.service.v1.ListEntitiesResponse.MetaData:type_name -> blobber.service.v1.FileRef - 28, // 13: blobber.service.v1.ListEntitiesResponse.Entities:type_name -> blobber.service.v1.FileRef - 28, // 14: blobber.service.v1.GetFileStatsResponse.MetaData:type_name -> blobber.service.v1.FileRef + 30, // 9: blobber.service.v1.ObjectPath.Meta:type_name -> blobber.service.v1.FileRef + 30, // 10: blobber.service.v1.ObjectPath.Path:type_name -> blobber.service.v1.FileRef + 30, // 11: blobber.service.v1.ObjectPath.PathList:type_name -> blobber.service.v1.FileRef + 30, // 12: blobber.service.v1.ListEntitiesResponse.MetaData:type_name -> blobber.service.v1.FileRef + 30, // 13: blobber.service.v1.ListEntitiesResponse.Entities:type_name -> blobber.service.v1.FileRef + 30, // 14: blobber.service.v1.GetFileStatsResponse.MetaData:type_name -> blobber.service.v1.FileRef 19, // 15: blobber.service.v1.GetFileStatsResponse.Stats:type_name -> blobber.service.v1.FileStats - 28, // 16: blobber.service.v1.GetFileMetaDataResponse.MetaData:type_name -> blobber.service.v1.FileRef + 30, // 16: blobber.service.v1.GetFileMetaDataResponse.MetaData:type_name -> blobber.service.v1.FileRef 23, // 17: blobber.service.v1.GetFileMetaDataResponse.Collaborators:type_name -> blobber.service.v1.Collaborator - 26, // 18: blobber.service.v1.GetAllocationResponse.allocation:type_name -> blobber.service.v1.Allocation - 27, // 19: blobber.service.v1.Allocation.Terms:type_name -> blobber.service.v1.Term - 29, // 20: blobber.service.v1.FileRef.FileMetaData:type_name -> blobber.service.v1.FileMetaData - 30, // 21: blobber.service.v1.FileRef.DirMetaData:type_name -> blobber.service.v1.DirMetaData + 28, // 18: blobber.service.v1.GetAllocationResponse.allocation:type_name -> blobber.service.v1.Allocation + 29, // 19: blobber.service.v1.Allocation.Terms:type_name -> blobber.service.v1.Term + 31, // 20: blobber.service.v1.FileRef.FileMetaData:type_name -> blobber.service.v1.FileMetaData + 32, // 21: blobber.service.v1.FileRef.DirMetaData:type_name -> blobber.service.v1.DirMetaData 22, // 22: blobber.service.v1.FileMetaData.CommitMetaTxns:type_name -> blobber.service.v1.CommitMetaTxn 24, // 23: blobber.service.v1.Blobber.GetAllocation:input_type -> blobber.service.v1.GetAllocationRequest 20, // 24: blobber.service.v1.Blobber.GetFileMetaData:input_type -> blobber.service.v1.GetFileMetaDataRequest @@ -3081,21 +3092,23 @@ var file_blobber_proto_depIdxs = []int32{ 11, // 27: blobber.service.v1.Blobber.GetObjectPath:input_type -> blobber.service.v1.GetObjectPathRequest 8, // 28: blobber.service.v1.Blobber.GetReferencePath:input_type -> blobber.service.v1.GetReferencePathRequest 6, // 29: blobber.service.v1.Blobber.GetObjectTree:input_type -> blobber.service.v1.GetObjectTreeRequest - 2, // 30: blobber.service.v1.Blobber.Commit:input_type -> blobber.service.v1.CommitRequest - 0, // 31: blobber.service.v1.Blobber.CalculateHash:input_type -> blobber.service.v1.CalculateHashRequest - 4, // 32: blobber.service.v1.Blobber.CommitMetaTxn:input_type -> blobber.service.v1.CommitMetaTxnRequest - 25, // 33: blobber.service.v1.Blobber.GetAllocation:output_type -> blobber.service.v1.GetAllocationResponse - 21, // 34: blobber.service.v1.Blobber.GetFileMetaData:output_type -> blobber.service.v1.GetFileMetaDataResponse - 18, // 35: blobber.service.v1.Blobber.GetFileStats:output_type -> blobber.service.v1.GetFileStatsResponse - 16, // 36: blobber.service.v1.Blobber.ListEntities:output_type -> blobber.service.v1.ListEntitiesResponse - 12, // 37: blobber.service.v1.Blobber.GetObjectPath:output_type -> blobber.service.v1.GetObjectPathResponse - 9, // 38: blobber.service.v1.Blobber.GetReferencePath:output_type -> blobber.service.v1.GetReferencePathResponse - 7, // 39: blobber.service.v1.Blobber.GetObjectTree:output_type -> blobber.service.v1.GetObjectTreeResponse - 3, // 40: blobber.service.v1.Blobber.Commit:output_type -> blobber.service.v1.CommitResponse - 1, // 41: blobber.service.v1.Blobber.CalculateHash:output_type -> blobber.service.v1.CalculateHashResponse - 5, // 42: blobber.service.v1.Blobber.CommitMetaTxn:output_type -> blobber.service.v1.CommitMetaTxnResponse - 33, // [33:43] is the sub-list for method output_type - 23, // [23:33] is the sub-list for method input_type + 26, // 30: blobber.service.v1.Blobber.RenameObject:input_type -> blobber.service.v1.RenameObjectRequest + 2, // 31: blobber.service.v1.Blobber.Commit:input_type -> blobber.service.v1.CommitRequest + 0, // 32: blobber.service.v1.Blobber.CalculateHash:input_type -> blobber.service.v1.CalculateHashRequest + 4, // 33: blobber.service.v1.Blobber.CommitMetaTxn:input_type -> blobber.service.v1.CommitMetaTxnRequest + 25, // 34: blobber.service.v1.Blobber.GetAllocation:output_type -> blobber.service.v1.GetAllocationResponse + 21, // 35: blobber.service.v1.Blobber.GetFileMetaData:output_type -> blobber.service.v1.GetFileMetaDataResponse + 18, // 36: blobber.service.v1.Blobber.GetFileStats:output_type -> blobber.service.v1.GetFileStatsResponse + 16, // 37: blobber.service.v1.Blobber.ListEntities:output_type -> blobber.service.v1.ListEntitiesResponse + 12, // 38: blobber.service.v1.Blobber.GetObjectPath:output_type -> blobber.service.v1.GetObjectPathResponse + 9, // 39: blobber.service.v1.Blobber.GetReferencePath:output_type -> blobber.service.v1.GetReferencePathResponse + 7, // 40: blobber.service.v1.Blobber.GetObjectTree:output_type -> blobber.service.v1.GetObjectTreeResponse + 27, // 41: blobber.service.v1.Blobber.RenameObject:output_type -> blobber.service.v1.RenameObjectResponse + 3, // 42: blobber.service.v1.Blobber.Commit:output_type -> blobber.service.v1.CommitResponse + 1, // 43: blobber.service.v1.Blobber.CalculateHash:output_type -> blobber.service.v1.CalculateHashResponse + 5, // 44: blobber.service.v1.Blobber.CommitMetaTxn:output_type -> blobber.service.v1.CommitMetaTxnResponse + 34, // [34:45] is the sub-list for method output_type + 23, // [23:34] is the sub-list for method input_type 23, // [23:23] is the sub-list for extension type_name 23, // [23:23] is the sub-list for extension extendee 0, // [0:23] is the sub-list for field type_name @@ -3420,7 +3433,6 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - file_blobber_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RenameObjectRequest); i { case 0: return &v.state @@ -3432,7 +3444,7 @@ func file_blobber_proto_init() { return nil } } - file_blobber_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_blobber_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RenameObjectResponse); i { case 0: return &v.state @@ -3444,7 +3456,7 @@ func file_blobber_proto_init() { return nil } } - file_blobber_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_blobber_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Allocation); i { case 0: return &v.state @@ -3456,7 +3468,7 @@ func file_blobber_proto_init() { return nil } } - file_blobber_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_blobber_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Term); i { case 0: return &v.state @@ -3468,7 +3480,7 @@ func file_blobber_proto_init() { return nil } } - file_blobber_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_blobber_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FileRef); i { case 0: return &v.state @@ -3480,7 +3492,7 @@ func file_blobber_proto_init() { return nil } } - file_blobber_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + file_blobber_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FileMetaData); i { case 0: return &v.state @@ -3492,7 +3504,7 @@ func file_blobber_proto_init() { return nil } } - file_blobber_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + file_blobber_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DirMetaData); i { case 0: return &v.state @@ -3511,7 +3523,7 @@ func file_blobber_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_blobber_proto_rawDesc, NumEnums: 0, - NumMessages: 31, + NumMessages: 33, NumExtensions: 0, NumServices: 1, }, diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go index b7454b149..b635a2b12 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go @@ -487,8 +487,8 @@ func local_request_Blobber_GetObjectTree_0(ctx context.Context, marshaler runtim } -func request_Blobber_Commit_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CommitRequest +func request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RenameObjectRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -516,13 +516,13 @@ func request_Blobber_Commit_0(ctx context.Context, marshaler runtime.Marshaler, return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - msg, err := client.Commit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.RenameObject(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Blobber_Commit_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CommitRequest +func local_request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RenameObjectRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -550,13 +550,13 @@ func local_request_Blobber_Commit_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - msg, err := server.Commit(ctx, &protoReq) + msg, err := server.RenameObject(ctx, &protoReq) return msg, metadata, err } -func request_Blobber_CalculateHash_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CalculateHashRequest +func request_Blobber_Commit_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CommitRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -584,13 +584,13 @@ func request_Blobber_CalculateHash_0(ctx context.Context, marshaler runtime.Mars return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - msg, err := client.CalculateHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.Commit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Blobber_CalculateHash_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CalculateHashRequest +func local_request_Blobber_Commit_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CommitRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -618,13 +618,13 @@ func local_request_Blobber_CalculateHash_0(ctx context.Context, marshaler runtim return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - msg, err := server.CalculateHash(ctx, &protoReq) + msg, err := server.Commit(ctx, &protoReq) return msg, metadata, err } -func request_Blobber_CommitMetaTxn_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CommitMetaTxnRequest +func request_Blobber_CalculateHash_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CalculateHashRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -652,13 +652,13 @@ func request_Blobber_CommitMetaTxn_0(ctx context.Context, marshaler runtime.Mars return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - msg, err := client.CommitMetaTxn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CalculateHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Blobber_CommitMetaTxn_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CommitMetaTxnRequest +func local_request_Blobber_CalculateHash_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CalculateHashRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -686,13 +686,13 @@ func local_request_Blobber_CommitMetaTxn_0(ctx context.Context, marshaler runtim return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - msg, err := server.CommitMetaTxn(ctx, &protoReq) + msg, err := server.CalculateHash(ctx, &protoReq) return msg, metadata, err } -func request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq RenameObjectRequest +func request_Blobber_CommitMetaTxn_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CommitMetaTxnRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -720,13 +720,13 @@ func request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - msg, err := client.RenameObject(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CommitMetaTxn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq RenameObjectRequest +func local_request_Blobber_CommitMetaTxn_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CommitMetaTxnRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -754,7 +754,7 @@ func local_request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - msg, err := server.RenameObject(ctx, &protoReq) + msg, err := server.CommitMetaTxn(ctx, &protoReq) return msg, metadata, err } @@ -926,18 +926,18 @@ func RegisterBlobberHandlerServer(ctx context.Context, mux *runtime.ServeMux, se }) - mux.Handle("POST", pattern_Blobber_Commit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_RenameObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/Commit") + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/RenameObject") if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Blobber_Commit_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Blobber_RenameObject_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -945,22 +945,22 @@ func RegisterBlobberHandlerServer(ctx context.Context, mux *runtime.ServeMux, se return } - forward_Blobber_Commit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Blobber_RenameObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Blobber_CalculateHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_Commit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/CalculateHash") + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/Commit") if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Blobber_CalculateHash_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Blobber_Commit_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -968,22 +968,22 @@ func RegisterBlobberHandlerServer(ctx context.Context, mux *runtime.ServeMux, se return } - forward_Blobber_CalculateHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Blobber_Commit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Blobber_CommitMetaTxn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_CalculateHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/CommitMetaTxn") + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/CalculateHash") if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Blobber_CommitMetaTxn_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Blobber_CalculateHash_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -991,22 +991,22 @@ func RegisterBlobberHandlerServer(ctx context.Context, mux *runtime.ServeMux, se return } - forward_Blobber_CommitMetaTxn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Blobber_CalculateHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Blobber_RenameObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_CommitMetaTxn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/RenameObject") + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/CommitMetaTxn") if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Blobber_RenameObject_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Blobber_CommitMetaTxn_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1014,7 +1014,7 @@ func RegisterBlobberHandlerServer(ctx context.Context, mux *runtime.ServeMux, se return } - forward_Blobber_RenameObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Blobber_CommitMetaTxn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1199,83 +1199,83 @@ func RegisterBlobberHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl }) - mux.Handle("POST", pattern_Blobber_Commit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_RenameObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/Commit") + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/RenameObject") if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Blobber_Commit_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Blobber_RenameObject_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Blobber_Commit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Blobber_RenameObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Blobber_CalculateHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_Commit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/CalculateHash") + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/Commit") if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Blobber_CalculateHash_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Blobber_Commit_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Blobber_CalculateHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Blobber_Commit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Blobber_CommitMetaTxn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_CalculateHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/CommitMetaTxn") + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/CalculateHash") if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Blobber_CommitMetaTxn_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Blobber_CalculateHash_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Blobber_CommitMetaTxn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Blobber_CalculateHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Blobber_RenameObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_CommitMetaTxn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/RenameObject") + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/CommitMetaTxn") if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Blobber_RenameObject_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Blobber_CommitMetaTxn_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Blobber_RenameObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Blobber_CommitMetaTxn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1297,13 +1297,13 @@ var ( pattern_Blobber_GetObjectTree_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "objecttree", "allocation"}, "")) + pattern_Blobber_RenameObject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "rename", "allocation"}, "")) + pattern_Blobber_Commit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "connection", "commit", "allocation"}, "")) pattern_Blobber_CalculateHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "calculatehash", "allocation"}, "")) pattern_Blobber_CommitMetaTxn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "commitmetatxn", "allocation"}, "")) - - pattern_Blobber_RenameObject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "rename", "allocation"}, "")) ) var ( @@ -1321,11 +1321,11 @@ var ( forward_Blobber_GetObjectTree_0 = runtime.ForwardResponseMessage + forward_Blobber_RenameObject_0 = runtime.ForwardResponseMessage + forward_Blobber_Commit_0 = runtime.ForwardResponseMessage forward_Blobber_CalculateHash_0 = runtime.ForwardResponseMessage forward_Blobber_CommitMetaTxn_0 = runtime.ForwardResponseMessage - - forward_Blobber_RenameObject_0 = runtime.ForwardResponseMessage ) diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go index aa2d40ece..1c0e4dcb7 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go @@ -24,10 +24,10 @@ type BlobberClient interface { GetObjectPath(ctx context.Context, in *GetObjectPathRequest, opts ...grpc.CallOption) (*GetObjectPathResponse, error) GetReferencePath(ctx context.Context, in *GetReferencePathRequest, opts ...grpc.CallOption) (*GetReferencePathResponse, error) GetObjectTree(ctx context.Context, in *GetObjectTreeRequest, opts ...grpc.CallOption) (*GetObjectTreeResponse, error) + RenameObject(ctx context.Context, in *RenameObjectRequest, opts ...grpc.CallOption) (*RenameObjectResponse, error) Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*CommitResponse, error) CalculateHash(ctx context.Context, in *CalculateHashRequest, opts ...grpc.CallOption) (*CalculateHashResponse, error) CommitMetaTxn(ctx context.Context, in *CommitMetaTxnRequest, opts ...grpc.CallOption) (*CommitMetaTxnResponse, error) - RenameObject(ctx context.Context, in *RenameObjectRequest, opts ...grpc.CallOption) (*RenameObjectResponse, error) } type blobberClient struct { @@ -101,6 +101,15 @@ func (c *blobberClient) GetObjectTree(ctx context.Context, in *GetObjectTreeRequ return out, nil } +func (c *blobberClient) RenameObject(ctx context.Context, in *RenameObjectRequest, opts ...grpc.CallOption) (*RenameObjectResponse, error) { + out := new(RenameObjectResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/RenameObject", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *blobberClient) Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*CommitResponse, error) { out := new(CommitResponse) err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/Commit", in, out, opts...) @@ -128,15 +137,6 @@ func (c *blobberClient) CommitMetaTxn(ctx context.Context, in *CommitMetaTxnRequ return out, nil } -func (c *blobberClient) RenameObject(ctx context.Context, in *RenameObjectRequest, opts ...grpc.CallOption) (*RenameObjectResponse, error) { - out := new(RenameObjectResponse) - err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/RenameObject", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // BlobberServer is the server API for Blobber service. // All implementations must embed UnimplementedBlobberServer // for forward compatibility @@ -148,10 +148,10 @@ type BlobberServer interface { GetObjectPath(context.Context, *GetObjectPathRequest) (*GetObjectPathResponse, error) GetReferencePath(context.Context, *GetReferencePathRequest) (*GetReferencePathResponse, error) GetObjectTree(context.Context, *GetObjectTreeRequest) (*GetObjectTreeResponse, error) + RenameObject(context.Context, *RenameObjectRequest) (*RenameObjectResponse, error) Commit(context.Context, *CommitRequest) (*CommitResponse, error) CalculateHash(context.Context, *CalculateHashRequest) (*CalculateHashResponse, error) CommitMetaTxn(context.Context, *CommitMetaTxnRequest) (*CommitMetaTxnResponse, error) - RenameObject(context.Context, *RenameObjectRequest) (*RenameObjectResponse, error) mustEmbedUnimplementedBlobberServer() } @@ -180,6 +180,9 @@ func (UnimplementedBlobberServer) GetReferencePath(context.Context, *GetReferenc func (UnimplementedBlobberServer) GetObjectTree(context.Context, *GetObjectTreeRequest) (*GetObjectTreeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetObjectTree not implemented") } +func (UnimplementedBlobberServer) RenameObject(context.Context, *RenameObjectRequest) (*RenameObjectResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RenameObject not implemented") +} func (UnimplementedBlobberServer) Commit(context.Context, *CommitRequest) (*CommitResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Commit not implemented") } @@ -189,9 +192,6 @@ func (UnimplementedBlobberServer) CalculateHash(context.Context, *CalculateHashR func (UnimplementedBlobberServer) CommitMetaTxn(context.Context, *CommitMetaTxnRequest) (*CommitMetaTxnResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CommitMetaTxn not implemented") } -func (UnimplementedBlobberServer) RenameObject(context.Context, *RenameObjectRequest) (*RenameObjectResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RenameObject not implemented") -} func (UnimplementedBlobberServer) mustEmbedUnimplementedBlobberServer() {} // UnsafeBlobberServer may be embedded to opt out of forward compatibility for this service. @@ -435,6 +435,10 @@ var _Blobber_serviceDesc = grpc.ServiceDesc{ MethodName: "GetObjectTree", Handler: _Blobber_GetObjectTree_Handler, }, + { + MethodName: "RenameObject", + Handler: _Blobber_RenameObject_Handler, + }, { MethodName: "Commit", Handler: _Blobber_Commit_Handler, @@ -447,10 +451,6 @@ var _Blobber_serviceDesc = grpc.ServiceDesc{ MethodName: "CommitMetaTxn", Handler: _Blobber_CommitMetaTxn_Handler, }, - { - MethodName: "RenameObject", - Handler: _Blobber_RenameObject_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "blobber.proto", diff --git a/code/go/0chain.net/blobbercore/handler/helper.go b/code/go/0chain.net/blobbercore/handler/helper.go index 675d4c327..dd9ea3487 100644 --- a/code/go/0chain.net/blobbercore/handler/helper.go +++ b/code/go/0chain.net/blobbercore/handler/helper.go @@ -44,7 +44,6 @@ type PackageHandler interface { GetAllocationChanges(ctx context.Context, connectionID string, allocationID string, clientID string) (*allocation.AllocationChangeCollector, error) SaveAllocationChanges(ctx context.Context, alloc *allocation.AllocationChangeCollector) error GetObjectTree(ctx context.Context, allocationID string, path string) (*reference.Ref, error) - GetAllocationChanges(ctx context.Context, connectionID string, allocationID string, clientID string) (*allocation.AllocationChangeCollector, error) VerifyMarker(wm *writemarker.WriteMarkerEntity, ctx context.Context, sa *allocation.Allocation, co *allocation.AllocationChangeCollector) error ApplyChanges(connectionObj *allocation.AllocationChangeCollector, ctx context.Context, allocationRoot string) error GetReference(ctx context.Context, allocationID string, path string) (*reference.Ref, error) @@ -121,12 +120,6 @@ func (r *packageHandler) IsACollaborator(ctx context.Context, refID int64, clien return reference.IsACollaborator(ctx, refID, clientID) } -func (r *packageHandler) GetAllocationChanges(ctx context.Context, connectionID string, - allocationID string, clientID string) (*allocation.AllocationChangeCollector, error) { - - return allocation.GetAllocationChanges(ctx, connectionID, allocationID, clientID) -} - func (r packageHandler) SaveAllocationChanges(ctx context.Context, alloc *allocation.AllocationChangeCollector) error { return alloc.Save(ctx) } diff --git a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go deleted file mode 100644 index 3dc22c7ac..000000000 --- a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go +++ /dev/null @@ -1,396 +0,0 @@ -// Code generated by mockery v0.0.0-dev. DO NOT EDIT. - -package mocks - -import ( - context "context" - - allocation "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" - - mock "github.com/stretchr/testify/mock" - - reference "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" - - stats "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" - - writemarker "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" -) - -// PackageHandler is an autogenerated mock type for the PackageHandler type -type PackageHandler struct { - mock.Mock -} - -// GetAllocationChanges provides a mock function with given fields: ctx, connectionID, allocationID, clientID -func (_m *PackageHandler) GetAllocationChanges(ctx context.Context, connectionID string, allocationID string, clientID string) (*allocation.AllocationChangeCollector, error) { - ret := _m.Called(ctx, connectionID, allocationID, clientID) - - var r0 *allocation.AllocationChangeCollector - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *allocation.AllocationChangeCollector); ok { - r0 = rf(ctx, connectionID, allocationID, clientID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*allocation.AllocationChangeCollector) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { - r1 = rf(ctx, connectionID, allocationID, clientID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// AddCommitMetaTxn provides a mock function with given fields: ctx, refID, txnID -func (_m *PackageHandler) AddCommitMetaTxn(ctx context.Context, refID int64, txnID string) error { - ret := _m.Called(ctx, refID, txnID) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok { - r0 = rf(ctx, refID, txnID) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// ApplyChanges provides a mock function with given fields: connectionObj, ctx, allocationRoot -func (_m *PackageHandler) ApplyChanges(connectionObj *allocation.AllocationChangeCollector, ctx context.Context, allocationRoot string) error { - ret := _m.Called(connectionObj, ctx, allocationRoot) - - var r0 error - if rf, ok := ret.Get(0).(func(*allocation.AllocationChangeCollector, context.Context, string) error); ok { - r0 = rf(connectionObj, ctx, allocationRoot) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// GetAllocationChanges provides a mock function with given fields: ctx, connectionID, allocationID, clientID -func (_m *PackageHandler) GetAllocationChanges(ctx context.Context, connectionID string, allocationID string, clientID string) (*allocation.AllocationChangeCollector, error) { - ret := _m.Called(ctx, connectionID, allocationID, clientID) - - var r0 *allocation.AllocationChangeCollector - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *allocation.AllocationChangeCollector); ok { - r0 = rf(ctx, connectionID, allocationID, clientID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*allocation.AllocationChangeCollector) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { - r1 = rf(ctx, connectionID, allocationID, clientID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetCollaborators provides a mock function with given fields: ctx, refID -func (_m *PackageHandler) GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) { - ret := _m.Called(ctx, refID) - - var r0 []reference.Collaborator - if rf, ok := ret.Get(0).(func(context.Context, int64) []reference.Collaborator); ok { - r0 = rf(ctx, refID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]reference.Collaborator) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(ctx, refID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetCommitMetaTxns provides a mock function with given fields: ctx, refID -func (_m *PackageHandler) GetCommitMetaTxns(ctx context.Context, refID int64) ([]reference.CommitMetaTxn, error) { - ret := _m.Called(ctx, refID) - - var r0 []reference.CommitMetaTxn - if rf, ok := ret.Get(0).(func(context.Context, int64) []reference.CommitMetaTxn); ok { - r0 = rf(ctx, refID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]reference.CommitMetaTxn) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(ctx, refID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetFileStats provides a mock function with given fields: ctx, refID -func (_m *PackageHandler) GetFileStats(ctx context.Context, refID int64) (*stats.FileStats, error) { - ret := _m.Called(ctx, refID) - - var r0 *stats.FileStats - if rf, ok := ret.Get(0).(func(context.Context, int64) *stats.FileStats); ok { - r0 = rf(ctx, refID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*stats.FileStats) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(ctx, refID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetObjectPath provides a mock function with given fields: ctx, allocationID, blockNum -func (_m *PackageHandler) GetObjectPath(ctx context.Context, allocationID string, blockNum int64) (*reference.ObjectPath, error) { - ret := _m.Called(ctx, allocationID, blockNum) - - var r0 *reference.ObjectPath - if rf, ok := ret.Get(0).(func(context.Context, string, int64) *reference.ObjectPath); ok { - r0 = rf(ctx, allocationID, blockNum) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.ObjectPath) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, int64) error); ok { - r1 = rf(ctx, allocationID, blockNum) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetObjectTree provides a mock function with given fields: ctx, allocationID, path -func (_m *PackageHandler) GetObjectTree(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { - ret := _m.Called(ctx, allocationID, path) - - var r0 *reference.Ref - if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { - r0 = rf(ctx, allocationID, path) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.Ref) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, allocationID, path) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetRefWithChildren provides a mock function with given fields: ctx, allocationID, path -func (_m *PackageHandler) GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { - ret := _m.Called(ctx, allocationID, path) - - var r0 *reference.Ref - if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { - r0 = rf(ctx, allocationID, path) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.Ref) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, allocationID, path) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetReference provides a mock function with given fields: ctx, allocationID, path -func (_m *PackageHandler) GetReference(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { - ret := _m.Called(ctx, allocationID, path) - - var r0 *reference.Ref - if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { - r0 = rf(ctx, allocationID, path) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.Ref) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, allocationID, path) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetReferenceFromLookupHash provides a mock function with given fields: ctx, allocationID, path_hash -func (_m *PackageHandler) GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) { - ret := _m.Called(ctx, allocationID, path_hash) - - var r0 *reference.Ref - if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { - r0 = rf(ctx, allocationID, path_hash) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.Ref) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, allocationID, path_hash) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetReferenceLookup provides a mock function with given fields: ctx, allocationID, path -func (_m *PackageHandler) GetReferenceLookup(ctx context.Context, allocationID string, path string) string { - ret := _m.Called(ctx, allocationID, path) - - var r0 string - if rf, ok := ret.Get(0).(func(context.Context, string, string) string); ok { - r0 = rf(ctx, allocationID, path) - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// GetReferencePathFromPaths provides a mock function with given fields: ctx, allocationID, paths -func (_m *PackageHandler) GetReferencePathFromPaths(ctx context.Context, allocationID string, paths []string) (*reference.Ref, error) { - ret := _m.Called(ctx, allocationID, paths) - - var r0 *reference.Ref - if rf, ok := ret.Get(0).(func(context.Context, string, []string) *reference.Ref); ok { - r0 = rf(ctx, allocationID, paths) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.Ref) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, []string) error); ok { - r1 = rf(ctx, allocationID, paths) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetWriteMarkerEntity provides a mock function with given fields: ctx, allocation_root -func (_m *PackageHandler) GetWriteMarkerEntity(ctx context.Context, allocation_root string) (*writemarker.WriteMarkerEntity, error) { - ret := _m.Called(ctx, allocation_root) - - var r0 *writemarker.WriteMarkerEntity - if rf, ok := ret.Get(0).(func(context.Context, string) *writemarker.WriteMarkerEntity); ok { - r0 = rf(ctx, allocation_root) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*writemarker.WriteMarkerEntity) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, allocation_root) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// IsACollaborator provides a mock function with given fields: ctx, refID, clientID -func (_m *PackageHandler) IsACollaborator(ctx context.Context, refID int64, clientID string) bool { - ret := _m.Called(ctx, refID, clientID) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, int64, string) bool); ok { - r0 = rf(ctx, refID, clientID) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// UpdateAllocationAndCommitChanges provides a mock function with given fields: ctx, writemarkerObj, connectionObj, allocationObj, allocationRoot -func (_m *PackageHandler) UpdateAllocationAndCommitChanges(ctx context.Context, writemarkerObj *writemarker.WriteMarkerEntity, connectionObj *allocation.AllocationChangeCollector, allocationObj *allocation.Allocation, allocationRoot string) error { - ret := _m.Called(ctx, writemarkerObj, connectionObj, allocationObj, allocationRoot) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *writemarker.WriteMarkerEntity, *allocation.AllocationChangeCollector, *allocation.Allocation, string) error); ok { - r0 = rf(ctx, writemarkerObj, connectionObj, allocationObj, allocationRoot) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// VerifyMarker provides a mock function with given fields: wm, ctx, sa, co -func (_m *PackageHandler) VerifyMarker(wm *writemarker.WriteMarkerEntity, ctx context.Context, sa *allocation.Allocation, co *allocation.AllocationChangeCollector) error { - ret := _m.Called(wm, ctx, sa, co) - - var r0 error - if rf, ok := ret.Get(0).(func(*writemarker.WriteMarkerEntity, context.Context, *allocation.Allocation, *allocation.AllocationChangeCollector) error); ok { - r0 = rf(wm, ctx, sa, co) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SaveAllocationChanges provides a mock function with given fields: ctx, alloc -func (_m *PackageHandler) SaveAllocationChanges(ctx context.Context, alloc *allocation.AllocationChangeCollector) error { - ret := _m.Called(ctx, alloc) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *allocation.AllocationChangeCollector) error); ok { - r0 = rf(ctx, alloc) - } else { - r0 = ret.Error(0) - } - - return r0 -} From f43c1f7d052334d387bda7fc407ac8251bd9c664 Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Sat, 5 Jun 2021 21:41:48 +0530 Subject: [PATCH 09/11] 156 conflicts resolved with grpc --- .../blobbercore/mocks/PackageHandler.go | 373 ++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 code/go/0chain.net/blobbercore/mocks/PackageHandler.go diff --git a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go new file mode 100644 index 000000000..52ae8d64b --- /dev/null +++ b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go @@ -0,0 +1,373 @@ +// Code generated by mockery 2.7.5. DO NOT EDIT. + +package mocks + +import ( + context "context" + + allocation "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + + mock "github.com/stretchr/testify/mock" + + reference "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + + stats "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + + writemarker "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" +) + +// PackageHandler is an autogenerated mock type for the PackageHandler type +type PackageHandler struct { + mock.Mock +} + +// AddCommitMetaTxn provides a mock function with given fields: ctx, refID, txnID +func (_m *PackageHandler) AddCommitMetaTxn(ctx context.Context, refID int64, txnID string) error { + ret := _m.Called(ctx, refID, txnID) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok { + r0 = rf(ctx, refID, txnID) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ApplyChanges provides a mock function with given fields: connectionObj, ctx, allocationRoot +func (_m *PackageHandler) ApplyChanges(connectionObj *allocation.AllocationChangeCollector, ctx context.Context, allocationRoot string) error { + ret := _m.Called(connectionObj, ctx, allocationRoot) + + var r0 error + if rf, ok := ret.Get(0).(func(*allocation.AllocationChangeCollector, context.Context, string) error); ok { + r0 = rf(connectionObj, ctx, allocationRoot) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GetAllocationChanges provides a mock function with given fields: ctx, connectionID, allocationID, clientID +func (_m *PackageHandler) GetAllocationChanges(ctx context.Context, connectionID string, allocationID string, clientID string) (*allocation.AllocationChangeCollector, error) { + ret := _m.Called(ctx, connectionID, allocationID, clientID) + + var r0 *allocation.AllocationChangeCollector + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *allocation.AllocationChangeCollector); ok { + r0 = rf(ctx, connectionID, allocationID, clientID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*allocation.AllocationChangeCollector) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { + r1 = rf(ctx, connectionID, allocationID, clientID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetCollaborators provides a mock function with given fields: ctx, refID +func (_m *PackageHandler) GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) { + ret := _m.Called(ctx, refID) + + var r0 []reference.Collaborator + if rf, ok := ret.Get(0).(func(context.Context, int64) []reference.Collaborator); ok { + r0 = rf(ctx, refID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]reference.Collaborator) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { + r1 = rf(ctx, refID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetCommitMetaTxns provides a mock function with given fields: ctx, refID +func (_m *PackageHandler) GetCommitMetaTxns(ctx context.Context, refID int64) ([]reference.CommitMetaTxn, error) { + ret := _m.Called(ctx, refID) + + var r0 []reference.CommitMetaTxn + if rf, ok := ret.Get(0).(func(context.Context, int64) []reference.CommitMetaTxn); ok { + r0 = rf(ctx, refID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]reference.CommitMetaTxn) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { + r1 = rf(ctx, refID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetFileStats provides a mock function with given fields: ctx, refID +func (_m *PackageHandler) GetFileStats(ctx context.Context, refID int64) (*stats.FileStats, error) { + ret := _m.Called(ctx, refID) + + var r0 *stats.FileStats + if rf, ok := ret.Get(0).(func(context.Context, int64) *stats.FileStats); ok { + r0 = rf(ctx, refID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*stats.FileStats) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { + r1 = rf(ctx, refID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetObjectPath provides a mock function with given fields: ctx, allocationID, blockNum +func (_m *PackageHandler) GetObjectPath(ctx context.Context, allocationID string, blockNum int64) (*reference.ObjectPath, error) { + ret := _m.Called(ctx, allocationID, blockNum) + + var r0 *reference.ObjectPath + if rf, ok := ret.Get(0).(func(context.Context, string, int64) *reference.ObjectPath); ok { + r0 = rf(ctx, allocationID, blockNum) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reference.ObjectPath) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, int64) error); ok { + r1 = rf(ctx, allocationID, blockNum) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetObjectTree provides a mock function with given fields: ctx, allocationID, path +func (_m *PackageHandler) GetObjectTree(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { + ret := _m.Called(ctx, allocationID, path) + + var r0 *reference.Ref + if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { + r0 = rf(ctx, allocationID, path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reference.Ref) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, allocationID, path) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetRefWithChildren provides a mock function with given fields: ctx, allocationID, path +func (_m *PackageHandler) GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { + ret := _m.Called(ctx, allocationID, path) + + var r0 *reference.Ref + if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { + r0 = rf(ctx, allocationID, path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reference.Ref) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, allocationID, path) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetReference provides a mock function with given fields: ctx, allocationID, path +func (_m *PackageHandler) GetReference(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { + ret := _m.Called(ctx, allocationID, path) + + var r0 *reference.Ref + if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { + r0 = rf(ctx, allocationID, path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reference.Ref) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, allocationID, path) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetReferenceFromLookupHash provides a mock function with given fields: ctx, allocationID, path_hash +func (_m *PackageHandler) GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) { + ret := _m.Called(ctx, allocationID, path_hash) + + var r0 *reference.Ref + if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { + r0 = rf(ctx, allocationID, path_hash) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reference.Ref) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, allocationID, path_hash) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetReferenceLookup provides a mock function with given fields: ctx, allocationID, path +func (_m *PackageHandler) GetReferenceLookup(ctx context.Context, allocationID string, path string) string { + ret := _m.Called(ctx, allocationID, path) + + var r0 string + if rf, ok := ret.Get(0).(func(context.Context, string, string) string); ok { + r0 = rf(ctx, allocationID, path) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// GetReferencePathFromPaths provides a mock function with given fields: ctx, allocationID, paths +func (_m *PackageHandler) GetReferencePathFromPaths(ctx context.Context, allocationID string, paths []string) (*reference.Ref, error) { + ret := _m.Called(ctx, allocationID, paths) + + var r0 *reference.Ref + if rf, ok := ret.Get(0).(func(context.Context, string, []string) *reference.Ref); ok { + r0 = rf(ctx, allocationID, paths) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reference.Ref) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string, []string) error); ok { + r1 = rf(ctx, allocationID, paths) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetWriteMarkerEntity provides a mock function with given fields: ctx, allocation_root +func (_m *PackageHandler) GetWriteMarkerEntity(ctx context.Context, allocation_root string) (*writemarker.WriteMarkerEntity, error) { + ret := _m.Called(ctx, allocation_root) + + var r0 *writemarker.WriteMarkerEntity + if rf, ok := ret.Get(0).(func(context.Context, string) *writemarker.WriteMarkerEntity); ok { + r0 = rf(ctx, allocation_root) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*writemarker.WriteMarkerEntity) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, allocation_root) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// IsACollaborator provides a mock function with given fields: ctx, refID, clientID +func (_m *PackageHandler) IsACollaborator(ctx context.Context, refID int64, clientID string) bool { + ret := _m.Called(ctx, refID, clientID) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, int64, string) bool); ok { + r0 = rf(ctx, refID, clientID) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// SaveAllocationChanges provides a mock function with given fields: ctx, alloc +func (_m *PackageHandler) SaveAllocationChanges(ctx context.Context, alloc *allocation.AllocationChangeCollector) error { + ret := _m.Called(ctx, alloc) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *allocation.AllocationChangeCollector) error); ok { + r0 = rf(ctx, alloc) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdateAllocationAndCommitChanges provides a mock function with given fields: ctx, writemarkerObj, connectionObj, allocationObj, allocationRoot +func (_m *PackageHandler) UpdateAllocationAndCommitChanges(ctx context.Context, writemarkerObj *writemarker.WriteMarkerEntity, connectionObj *allocation.AllocationChangeCollector, allocationObj *allocation.Allocation, allocationRoot string) error { + ret := _m.Called(ctx, writemarkerObj, connectionObj, allocationObj, allocationRoot) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *writemarker.WriteMarkerEntity, *allocation.AllocationChangeCollector, *allocation.Allocation, string) error); ok { + r0 = rf(ctx, writemarkerObj, connectionObj, allocationObj, allocationRoot) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// VerifyMarker provides a mock function with given fields: wm, ctx, sa, co +func (_m *PackageHandler) VerifyMarker(wm *writemarker.WriteMarkerEntity, ctx context.Context, sa *allocation.Allocation, co *allocation.AllocationChangeCollector) error { + ret := _m.Called(wm, ctx, sa, co) + + var r0 error + if rf, ok := ret.Get(0).(func(*writemarker.WriteMarkerEntity, context.Context, *allocation.Allocation, *allocation.AllocationChangeCollector) error); ok { + r0 = rf(wm, ctx, sa, co) + } else { + r0 = ret.Error(0) + } + + return r0 +} From 3b916bb44b51fa23f6ab89679bb7d3cee0f84300 Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Tue, 15 Jun 2021 23:13:13 +0530 Subject: [PATCH 10/11] grpc -> http implemented for rename handler --- .../blobbercore/blobbergrpc/blobber.pb.go | 290 ++++++++++-------- .../blobbercore/convert/responseHandler.go | 21 +- .../0chain.net/blobbercore/handler/handler.go | 25 +- .../blobbercore/handler/handler_test.go | 2 +- .../handler/object_operation_grpc_handler.go | 21 +- .../object_operation_grpc_handler_test.go | 0 6 files changed, 203 insertions(+), 156 deletions(-) delete mode 100644 code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go index 7751ff87f..753227348 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go @@ -2134,7 +2134,7 @@ type RenameObjectRequest struct { func (x *RenameObjectRequest) Reset() { *x = RenameObjectRequest{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[26] + mi := &file_blobber_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2147,7 +2147,7 @@ func (x *RenameObjectRequest) String() string { func (*RenameObjectRequest) ProtoMessage() {} func (x *RenameObjectRequest) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[26] + mi := &file_blobber_proto_msgTypes[32] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2160,7 +2160,7 @@ func (x *RenameObjectRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RenameObjectRequest.ProtoReflect.Descriptor instead. func (*RenameObjectRequest) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{26} + return file_blobber_proto_rawDescGZIP(), []int{32} } func (x *RenameObjectRequest) GetAllocation() string { @@ -2216,7 +2216,7 @@ type RenameObjectResponse struct { func (x *RenameObjectResponse) Reset() { *x = RenameObjectResponse{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[27] + mi := &file_blobber_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2229,7 +2229,7 @@ func (x *RenameObjectResponse) String() string { func (*RenameObjectResponse) ProtoMessage() {} func (x *RenameObjectResponse) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[27] + mi := &file_blobber_proto_msgTypes[33] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2242,7 +2242,7 @@ func (x *RenameObjectResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RenameObjectResponse.ProtoReflect.Descriptor instead. func (*RenameObjectResponse) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{27} + return file_blobber_proto_rawDescGZIP(), []int{33} } func (x *RenameObjectResponse) GetFilename() string { @@ -2314,7 +2314,7 @@ type Allocation struct { func (x *Allocation) Reset() { *x = Allocation{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[32] + mi := &file_blobber_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2327,7 +2327,7 @@ func (x *Allocation) String() string { func (*Allocation) ProtoMessage() {} func (x *Allocation) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[32] + mi := &file_blobber_proto_msgTypes[34] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2340,7 +2340,7 @@ func (x *Allocation) ProtoReflect() protoreflect.Message { // Deprecated: Use Allocation.ProtoReflect.Descriptor instead. func (*Allocation) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{32} + return file_blobber_proto_rawDescGZIP(), []int{34} } func (x *Allocation) GetID() string { @@ -2477,7 +2477,7 @@ type Term struct { func (x *Term) Reset() { *x = Term{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[33] + mi := &file_blobber_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2490,7 +2490,7 @@ func (x *Term) String() string { func (*Term) ProtoMessage() {} func (x *Term) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[33] + mi := &file_blobber_proto_msgTypes[35] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2503,7 +2503,7 @@ func (x *Term) ProtoReflect() protoreflect.Message { // Deprecated: Use Term.ProtoReflect.Descriptor instead. func (*Term) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{33} + return file_blobber_proto_rawDescGZIP(), []int{35} } func (x *Term) GetID() int64 { @@ -2554,7 +2554,7 @@ type FileRef struct { func (x *FileRef) Reset() { *x = FileRef{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[34] + mi := &file_blobber_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2567,7 +2567,7 @@ func (x *FileRef) String() string { func (*FileRef) ProtoMessage() {} func (x *FileRef) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[34] + mi := &file_blobber_proto_msgTypes[36] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2580,7 +2580,7 @@ func (x *FileRef) ProtoReflect() protoreflect.Message { // Deprecated: Use FileRef.ProtoReflect.Descriptor instead. func (*FileRef) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{34} + return file_blobber_proto_rawDescGZIP(), []int{36} } func (x *FileRef) GetType() string { @@ -2638,7 +2638,7 @@ type FileMetaData struct { func (x *FileMetaData) Reset() { *x = FileMetaData{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[35] + mi := &file_blobber_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2651,7 +2651,7 @@ func (x *FileMetaData) String() string { func (*FileMetaData) ProtoMessage() {} func (x *FileMetaData) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[35] + mi := &file_blobber_proto_msgTypes[37] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2664,7 +2664,7 @@ func (x *FileMetaData) ProtoReflect() protoreflect.Message { // Deprecated: Use FileMetaData.ProtoReflect.Descriptor instead. func (*FileMetaData) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{35} + return file_blobber_proto_rawDescGZIP(), []int{37} } func (x *FileMetaData) GetType() string { @@ -2855,7 +2855,7 @@ type DirMetaData struct { func (x *DirMetaData) Reset() { *x = DirMetaData{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[36] + mi := &file_blobber_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2868,7 +2868,7 @@ func (x *DirMetaData) String() string { func (*DirMetaData) ProtoMessage() {} func (x *DirMetaData) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[36] + mi := &file_blobber_proto_msgTypes[38] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2881,7 +2881,7 @@ func (x *DirMetaData) ProtoReflect() protoreflect.Message { // Deprecated: Use DirMetaData.ProtoReflect.Descriptor instead. func (*DirMetaData) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{36} + return file_blobber_proto_rawDescGZIP(), []int{38} } func (x *DirMetaData) GetType() string { @@ -3246,6 +3246,30 @@ var file_blobber_proto_rawDesc = []byte{ 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0xa6, 0x01, 0x0a, 0x13, 0x52, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x4e, 0x61, + 0x6d, 0x65, 0x22, 0xd4, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1f, + 0x0a, 0x0b, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, + 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0xb6, 0x04, 0x0a, 0x0a, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x78, 0x18, 0x02, @@ -3370,7 +3394,7 @@ var file_blobber_proto_rawDesc = []byte{ 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x32, 0xdd, 0x0e, 0x0a, 0x07, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x12, 0x7c, 0x0a, 0x0d, + 0x32, 0xea, 0x0f, 0x0a, 0x07, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x12, 0x7c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, @@ -3432,66 +3456,75 @@ var file_blobber_proto_rawDesc = []byte{ 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x74, 0x72, 0x65, 0x65, 0x2f, 0x7b, - 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x7e, 0x0a, 0x06, 0x43, - 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, + 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x8a, 0x01, 0x0a, 0x0c, + 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x27, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, + 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, + 0x65, 0x2f, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x7e, 0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x12, 0x21, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, - 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, - 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x27, 0x22, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, - 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x94, 0x01, 0x0a, 0x0d, - 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x28, 0x2e, - 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, - 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, - 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, 0x76, 0x32, 0x2f, - 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x68, 0x61, - 0x73, 0x68, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, - 0x01, 0x2a, 0x12, 0x94, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, - 0x61, 0x54, 0x78, 0x6e, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, - 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, - 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x28, 0x22, 0x23, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x6d, 0x65, 0x74, 0x61, 0x74, 0x78, 0x6e, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0xac, 0x01, 0x0a, 0x16, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x12, 0x31, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x27, 0x22, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x94, 0x01, 0x0a, 0x0d, 0x43, 0x61, 0x6c, + 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, + 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, + 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, + 0x65, 0x2f, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x68, 0x61, 0x73, 0x68, 0x2f, + 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, + 0x94, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, + 0x6e, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, + 0x61, 0x54, 0x78, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, + 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, + 0x65, 0x74, 0x61, 0x74, 0x78, 0x6e, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0xac, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x12, 0x31, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, - 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x25, 0x22, 0x20, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x82, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x70, - 0x79, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x25, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, - 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x70, - 0x79, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, - 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x1a, - 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x70, 0x79, 0x2f, 0x7b, 0x61, - 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x90, 0x01, - 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x27, - 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, - 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, - 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x22, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x66, - 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, - 0x42, 0x2c, 0x5a, 0x2a, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x6f, 0x2f, 0x30, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, + 0x22, 0x20, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x82, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x12, 0x25, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x1a, 0x2f, 0x76, 0x32, + 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x70, 0x79, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x90, 0x01, 0x0a, 0x0c, 0x43, + 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x27, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, + 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x22, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, + 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x7b, 0x61, + 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x42, 0x2c, 0x5a, + 0x2a, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x67, 0x6f, 0x2f, 0x30, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, + 0x6e, 0x65, 0x74, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x63, 0x6f, 0x72, 0x65, 0x2f, + 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -3506,7 +3539,7 @@ func file_blobber_proto_rawDescGZIP() []byte { return file_blobber_proto_rawDescData } -var file_blobber_proto_msgTypes = make([]protoimpl.MessageInfo, 37) +var file_blobber_proto_msgTypes = make([]protoimpl.MessageInfo, 39) var file_blobber_proto_goTypes = []interface{}{ (*CollaboratorRequest)(nil), // 0: blobber.service.v1.CollaboratorRequest (*CollaboratorResponse)(nil), // 1: blobber.service.v1.CollaboratorResponse @@ -3540,11 +3573,13 @@ var file_blobber_proto_goTypes = []interface{}{ (*UpdateObjectAttributesResponse)(nil), // 29: blobber.service.v1.UpdateObjectAttributesResponse (*CopyObjectRequest)(nil), // 30: blobber.service.v1.CopyObjectRequest (*CopyObjectResponse)(nil), // 31: blobber.service.v1.CopyObjectResponse - (*Allocation)(nil), // 32: blobber.service.v1.Allocation - (*Term)(nil), // 33: blobber.service.v1.Term - (*FileRef)(nil), // 34: blobber.service.v1.FileRef - (*FileMetaData)(nil), // 35: blobber.service.v1.FileMetaData - (*DirMetaData)(nil), // 36: blobber.service.v1.DirMetaData + (*RenameObjectRequest)(nil), // 32: blobber.service.v1.RenameObjectRequest + (*RenameObjectResponse)(nil), // 33: blobber.service.v1.RenameObjectResponse + (*Allocation)(nil), // 34: blobber.service.v1.Allocation + (*Term)(nil), // 35: blobber.service.v1.Term + (*FileRef)(nil), // 36: blobber.service.v1.FileRef + (*FileMetaData)(nil), // 37: blobber.service.v1.FileMetaData + (*DirMetaData)(nil), // 38: blobber.service.v1.DirMetaData } var file_blobber_proto_depIdxs = []int32{ 25, // 0: blobber.service.v1.CollaboratorResponse.Collaborators:type_name -> blobber.service.v1.Collaborator @@ -3553,23 +3588,23 @@ var file_blobber_proto_depIdxs = []int32{ 16, // 3: blobber.service.v1.GetObjectTreeResponse.LatestWM:type_name -> blobber.service.v1.WriteMarker 12, // 4: blobber.service.v1.GetReferencePathResponse.ReferencePath:type_name -> blobber.service.v1.ReferencePath 16, // 5: blobber.service.v1.GetReferencePathResponse.LatestWM:type_name -> blobber.service.v1.WriteMarker - 34, // 6: blobber.service.v1.ReferencePath.MetaData:type_name -> blobber.service.v1.FileRef + 36, // 6: blobber.service.v1.ReferencePath.MetaData:type_name -> blobber.service.v1.FileRef 12, // 7: blobber.service.v1.ReferencePath.List:type_name -> blobber.service.v1.ReferencePath 15, // 8: blobber.service.v1.GetObjectPathResponse.ObjectPath:type_name -> blobber.service.v1.ObjectPath 16, // 9: blobber.service.v1.GetObjectPathResponse.LatestWriteMarker:type_name -> blobber.service.v1.WriteMarker - 34, // 10: blobber.service.v1.ObjectPath.Meta:type_name -> blobber.service.v1.FileRef - 34, // 11: blobber.service.v1.ObjectPath.Path:type_name -> blobber.service.v1.FileRef - 34, // 12: blobber.service.v1.ObjectPath.PathList:type_name -> blobber.service.v1.FileRef - 34, // 13: blobber.service.v1.ListEntitiesResponse.MetaData:type_name -> blobber.service.v1.FileRef - 34, // 14: blobber.service.v1.ListEntitiesResponse.Entities:type_name -> blobber.service.v1.FileRef - 34, // 15: blobber.service.v1.GetFileStatsResponse.MetaData:type_name -> blobber.service.v1.FileRef + 36, // 10: blobber.service.v1.ObjectPath.Meta:type_name -> blobber.service.v1.FileRef + 36, // 11: blobber.service.v1.ObjectPath.Path:type_name -> blobber.service.v1.FileRef + 36, // 12: blobber.service.v1.ObjectPath.PathList:type_name -> blobber.service.v1.FileRef + 36, // 13: blobber.service.v1.ListEntitiesResponse.MetaData:type_name -> blobber.service.v1.FileRef + 36, // 14: blobber.service.v1.ListEntitiesResponse.Entities:type_name -> blobber.service.v1.FileRef + 36, // 15: blobber.service.v1.GetFileStatsResponse.MetaData:type_name -> blobber.service.v1.FileRef 21, // 16: blobber.service.v1.GetFileStatsResponse.Stats:type_name -> blobber.service.v1.FileStats - 34, // 17: blobber.service.v1.GetFileMetaDataResponse.MetaData:type_name -> blobber.service.v1.FileRef + 36, // 17: blobber.service.v1.GetFileMetaDataResponse.MetaData:type_name -> blobber.service.v1.FileRef 25, // 18: blobber.service.v1.GetFileMetaDataResponse.Collaborators:type_name -> blobber.service.v1.Collaborator - 32, // 19: blobber.service.v1.GetAllocationResponse.allocation:type_name -> blobber.service.v1.Allocation - 33, // 20: blobber.service.v1.Allocation.Terms:type_name -> blobber.service.v1.Term - 35, // 21: blobber.service.v1.FileRef.FileMetaData:type_name -> blobber.service.v1.FileMetaData - 36, // 22: blobber.service.v1.FileRef.DirMetaData:type_name -> blobber.service.v1.DirMetaData + 34, // 19: blobber.service.v1.GetAllocationResponse.allocation:type_name -> blobber.service.v1.Allocation + 35, // 20: blobber.service.v1.Allocation.Terms:type_name -> blobber.service.v1.Term + 37, // 21: blobber.service.v1.FileRef.FileMetaData:type_name -> blobber.service.v1.FileMetaData + 38, // 22: blobber.service.v1.FileRef.DirMetaData:type_name -> blobber.service.v1.DirMetaData 24, // 23: blobber.service.v1.FileMetaData.CommitMetaTxns:type_name -> blobber.service.v1.CommitMetaTxn 26, // 24: blobber.service.v1.Blobber.GetAllocation:input_type -> blobber.service.v1.GetAllocationRequest 22, // 25: blobber.service.v1.Blobber.GetFileMetaData:input_type -> blobber.service.v1.GetFileMetaDataRequest @@ -3578,27 +3613,29 @@ var file_blobber_proto_depIdxs = []int32{ 13, // 28: blobber.service.v1.Blobber.GetObjectPath:input_type -> blobber.service.v1.GetObjectPathRequest 10, // 29: blobber.service.v1.Blobber.GetReferencePath:input_type -> blobber.service.v1.GetReferencePathRequest 8, // 30: blobber.service.v1.Blobber.GetObjectTree:input_type -> blobber.service.v1.GetObjectTreeRequest - 4, // 31: blobber.service.v1.Blobber.Commit:input_type -> blobber.service.v1.CommitRequest - 2, // 32: blobber.service.v1.Blobber.CalculateHash:input_type -> blobber.service.v1.CalculateHashRequest - 6, // 33: blobber.service.v1.Blobber.CommitMetaTxn:input_type -> blobber.service.v1.CommitMetaTxnRequest - 28, // 34: blobber.service.v1.Blobber.UpdateObjectAttributes:input_type -> blobber.service.v1.UpdateObjectAttributesRequest - 30, // 35: blobber.service.v1.Blobber.CopyObject:input_type -> blobber.service.v1.CopyObjectRequest - 0, // 36: blobber.service.v1.Blobber.Collaborator:input_type -> blobber.service.v1.CollaboratorRequest - 27, // 37: blobber.service.v1.Blobber.GetAllocation:output_type -> blobber.service.v1.GetAllocationResponse - 23, // 38: blobber.service.v1.Blobber.GetFileMetaData:output_type -> blobber.service.v1.GetFileMetaDataResponse - 20, // 39: blobber.service.v1.Blobber.GetFileStats:output_type -> blobber.service.v1.GetFileStatsResponse - 18, // 40: blobber.service.v1.Blobber.ListEntities:output_type -> blobber.service.v1.ListEntitiesResponse - 14, // 41: blobber.service.v1.Blobber.GetObjectPath:output_type -> blobber.service.v1.GetObjectPathResponse - 11, // 42: blobber.service.v1.Blobber.GetReferencePath:output_type -> blobber.service.v1.GetReferencePathResponse - 9, // 43: blobber.service.v1.Blobber.GetObjectTree:output_type -> blobber.service.v1.GetObjectTreeResponse - 5, // 44: blobber.service.v1.Blobber.Commit:output_type -> blobber.service.v1.CommitResponse - 3, // 45: blobber.service.v1.Blobber.CalculateHash:output_type -> blobber.service.v1.CalculateHashResponse - 7, // 46: blobber.service.v1.Blobber.CommitMetaTxn:output_type -> blobber.service.v1.CommitMetaTxnResponse - 29, // 47: blobber.service.v1.Blobber.UpdateObjectAttributes:output_type -> blobber.service.v1.UpdateObjectAttributesResponse - 31, // 48: blobber.service.v1.Blobber.CopyObject:output_type -> blobber.service.v1.CopyObjectResponse - 1, // 49: blobber.service.v1.Blobber.Collaborator:output_type -> blobber.service.v1.CollaboratorResponse - 37, // [37:50] is the sub-list for method output_type - 24, // [24:37] is the sub-list for method input_type + 32, // 31: blobber.service.v1.Blobber.RenameObject:input_type -> blobber.service.v1.RenameObjectRequest + 4, // 32: blobber.service.v1.Blobber.Commit:input_type -> blobber.service.v1.CommitRequest + 2, // 33: blobber.service.v1.Blobber.CalculateHash:input_type -> blobber.service.v1.CalculateHashRequest + 6, // 34: blobber.service.v1.Blobber.CommitMetaTxn:input_type -> blobber.service.v1.CommitMetaTxnRequest + 28, // 35: blobber.service.v1.Blobber.UpdateObjectAttributes:input_type -> blobber.service.v1.UpdateObjectAttributesRequest + 30, // 36: blobber.service.v1.Blobber.CopyObject:input_type -> blobber.service.v1.CopyObjectRequest + 0, // 37: blobber.service.v1.Blobber.Collaborator:input_type -> blobber.service.v1.CollaboratorRequest + 27, // 38: blobber.service.v1.Blobber.GetAllocation:output_type -> blobber.service.v1.GetAllocationResponse + 23, // 39: blobber.service.v1.Blobber.GetFileMetaData:output_type -> blobber.service.v1.GetFileMetaDataResponse + 20, // 40: blobber.service.v1.Blobber.GetFileStats:output_type -> blobber.service.v1.GetFileStatsResponse + 18, // 41: blobber.service.v1.Blobber.ListEntities:output_type -> blobber.service.v1.ListEntitiesResponse + 14, // 42: blobber.service.v1.Blobber.GetObjectPath:output_type -> blobber.service.v1.GetObjectPathResponse + 11, // 43: blobber.service.v1.Blobber.GetReferencePath:output_type -> blobber.service.v1.GetReferencePathResponse + 9, // 44: blobber.service.v1.Blobber.GetObjectTree:output_type -> blobber.service.v1.GetObjectTreeResponse + 33, // 45: blobber.service.v1.Blobber.RenameObject:output_type -> blobber.service.v1.RenameObjectResponse + 5, // 46: blobber.service.v1.Blobber.Commit:output_type -> blobber.service.v1.CommitResponse + 3, // 47: blobber.service.v1.Blobber.CalculateHash:output_type -> blobber.service.v1.CalculateHashResponse + 7, // 48: blobber.service.v1.Blobber.CommitMetaTxn:output_type -> blobber.service.v1.CommitMetaTxnResponse + 29, // 49: blobber.service.v1.Blobber.UpdateObjectAttributes:output_type -> blobber.service.v1.UpdateObjectAttributesResponse + 31, // 50: blobber.service.v1.Blobber.CopyObject:output_type -> blobber.service.v1.CopyObjectResponse + 1, // 51: blobber.service.v1.Blobber.Collaborator:output_type -> blobber.service.v1.CollaboratorResponse + 38, // [38:52] is the sub-list for method output_type + 24, // [24:38] is the sub-list for method input_type 24, // [24:24] is the sub-list for extension type_name 24, // [24:24] is the sub-list for extension extendee 0, // [0:24] is the sub-list for field type_name @@ -3995,8 +4032,6 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Allocation); i { - file_blobber_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RenameObjectRequest); i { case 0: return &v.state @@ -4009,7 +4044,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Term); i { + switch v := v.(*RenameObjectResponse); i { case 0: return &v.state case 1: @@ -4021,7 +4056,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileRef); i { + switch v := v.(*Allocation); i { case 0: return &v.state case 1: @@ -4033,7 +4068,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileMetaData); i { + switch v := v.(*Term); i { case 0: return &v.state case 1: @@ -4044,7 +4079,7 @@ func file_blobber_proto_init() { return nil } } - file_blobber_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + file_blobber_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FileRef); i { case 0: return &v.state @@ -4056,7 +4091,7 @@ func file_blobber_proto_init() { return nil } } - file_blobber_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + file_blobber_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FileMetaData); i { case 0: return &v.state @@ -4068,8 +4103,7 @@ func file_blobber_proto_init() { return nil } } - file_blobber_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - file_blobber_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + file_blobber_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DirMetaData); i { case 0: return &v.state @@ -4088,7 +4122,7 @@ func file_blobber_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_blobber_proto_rawDesc, NumEnums: 0, - NumMessages: 37, + NumMessages: 39, NumExtensions: 0, NumServices: 1, }, diff --git a/code/go/0chain.net/blobbercore/convert/responseHandler.go b/code/go/0chain.net/blobbercore/convert/responseHandler.go index 7bca51351..a8b1a721e 100644 --- a/code/go/0chain.net/blobbercore/convert/responseHandler.go +++ b/code/go/0chain.net/blobbercore/convert/responseHandler.go @@ -203,13 +203,18 @@ func CopyObjectResponseCreator(r interface{}) *blobbergrpc.CopyObjectResponse { } } -func RenameObjectResponseHandler(renameObjectResponse *blobbergrpc.RenameObjectResponse) *blobberHTTP.UploadResult { - return &blobberHTTP.UploadResult{ - Filename: renameObjectResponse.Filename, - Size: renameObjectResponse.Size, - Hash: renameObjectResponse.ContentHash, - MerkleRoot: renameObjectResponse.MerkleRoot, - UploadLength: renameObjectResponse.UploadLength, - UploadOffset: renameObjectResponse.UploadOffset, +func RenameObjectResponseCreator(r interface{}) *blobbergrpc.RenameObjectResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*blobberHTTP.UploadResult) + return &blobbergrpc.RenameObjectResponse{ + Filename: httpResp.Filename, + Size: httpResp.Size, + ContentHash: httpResp.Hash, + MerkleRoot: httpResp.MerkleRoot, + UploadLength: httpResp.UploadLength, + UploadOffset: httpResp.UploadOffset, } } diff --git a/code/go/0chain.net/blobbercore/handler/handler.go b/code/go/0chain.net/blobbercore/handler/handler.go index ecf73f3a0..45b7163fb 100644 --- a/code/go/0chain.net/blobbercore/handler/handler.go +++ b/code/go/0chain.net/blobbercore/handler/handler.go @@ -31,7 +31,7 @@ func SetupHandlers(r *mux.Router) { //object operations r.HandleFunc("/v1/file/upload/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(UploadHandler)))) r.HandleFunc("/v1/file/download/{allocation}", common.UserRateLimit(common.ToByteStream(WithConnection(DownloadHandler)))) - r.HandleFunc("/v1/file/rename/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(RenameHandler(svc))))).Methods(http.MethodPost) + r.HandleFunc("/v1/file/rename/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(RenameHandler)))) r.HandleFunc("/v1/file/copy/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(CopyHandler)))) r.HandleFunc("/v1/file/attributes/{allocation}", common.UserRateLimit(common.ToJSONResponse(WithConnection(UpdateAttributesHandler)))) @@ -239,23 +239,14 @@ func ObjectTreeHandler(ctx context.Context, r *http.Request) (interface{}, error return response, nil } -func RenameHandler(svc *blobberGRPCService) func(ctx context.Context, r *http.Request) (interface{}, error) { - return func(ctx context.Context, r *http.Request) (interface{}, error) { - ctx = setupHandlerGRPCContext(ctx, r) - - renameObjResponse, err := svc.RenameObject(ctx, &blobbergrpc.RenameObjectRequest{ - Allocation: mux.Vars(r)["allocation"], - Path: r.FormValue("path"), - PathHash: r.FormValue("path_hash"), - ConnectionId: r.FormValue("connection_id"), - NewName: r.FormValue("new_name"), - }) - if err != nil { - return nil, err - } - - return convert.RenameObjectResponseHandler(renameObjResponse), nil +func RenameHandler(ctx context.Context, r *http.Request) (interface{}, error) { + ctx = setupHandlerContext(ctx, r) + response, err := storageHandler.RenameObject(ctx, r) + if err != nil { + return nil, err } + + return response, nil } func CopyHandler(ctx context.Context, r *http.Request) (interface{}, error) { diff --git a/code/go/0chain.net/blobbercore/handler/handler_test.go b/code/go/0chain.net/blobbercore/handler/handler_test.go index 87715f60a..49614a930 100644 --- a/code/go/0chain.net/blobbercore/handler/handler_test.go +++ b/code/go/0chain.net/blobbercore/handler/handler_test.go @@ -139,7 +139,7 @@ func setupHandlers() (*mux.Router, map[string]string) { rName := "Rename" router.HandleFunc(rPath, common.UserRateLimit( common.ToJSONResponse( - WithReadOnlyConnection(RenameHandler(svc)), + WithReadOnlyConnection(RenameHandler), ), ), ).Name(rName) diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go index 977b6ef98..151d2f146 100644 --- a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go +++ b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go @@ -50,6 +50,23 @@ func (b *blobberGRPCService) CopyObject(ctx context.Context, req *blobbergrpc.Co return convert.CopyObjectResponseCreator(resp), nil } -func (b *blobberGRPCService) RenameObject(ctx context.Context, r *blobbergrpc.RenameObjectRequest) (*blobbergrpc.RenameObjectResponse, error) { - return nil, nil +func (b *blobberGRPCService) RenameObject(ctx context.Context, req *blobbergrpc.RenameObjectRequest) (*blobbergrpc.RenameObjectResponse, error) { + r, err := http.NewRequest("POST", "", nil) + if err != nil { + return nil, err + } + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "path_hash": {req.PathHash}, + "connection_id": {req.ConnectionId}, + "new_name": {req.NewName}, + } + + resp, err := RenameHandler(ctx, r) + if err != nil { + return nil, err + } + + return convert.RenameObjectResponseCreator(resp), nil } diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler_test.go deleted file mode 100644 index e69de29bb..000000000 From 23b7a80f88a4ac070c024f6c6834489486fbbf45 Mon Sep 17 00:00:00 2001 From: nipunapathirana Date: Tue, 15 Jun 2021 23:24:27 +0530 Subject: [PATCH 11/11] grpc merge resolved for rename handler --- .../0chain.net/blobbercore/convert/responseHandler.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/go/0chain.net/blobbercore/convert/responseHandler.go b/code/go/0chain.net/blobbercore/convert/responseHandler.go index e8bb8e8ee..8ddd47302 100644 --- a/code/go/0chain.net/blobbercore/convert/responseHandler.go +++ b/code/go/0chain.net/blobbercore/convert/responseHandler.go @@ -129,7 +129,7 @@ func GetObjectPathResponseCreator(r interface{}) *blobbergrpc.GetObjectPathRespo return &resp } -func CommitWriteResponseHandler(r interface{}) *blobbergrpc.CommitResponse { +func CommitWriteResponseCreator(r interface{}) *blobbergrpc.CommitResponse { if r == nil { return nil } @@ -144,14 +144,14 @@ func CommitWriteResponseHandler(r interface{}) *blobbergrpc.CommitResponse { } } -func GetCalculateHashResponseHandler(r interface{}) *blobbergrpc.CalculateHashResponse { +func GetCalculateHashResponseCreator(r interface{}) *blobbergrpc.CalculateHashResponse { httpResp, _ := r.(map[string]interface{}) msg, _ := httpResp["msg"].(string) return &blobbergrpc.CalculateHashResponse{Message: msg} } -func GetCommitMetaTxnHandlerResponse(r interface{}) *blobbergrpc.CommitMetaTxnResponse { +func GetCommitMetaTxnResponseCreator(r interface{}) *blobbergrpc.CommitMetaTxnResponse { msg, _ := r.(struct { Msg string `json:"msg"` }) @@ -159,7 +159,7 @@ func GetCommitMetaTxnHandlerResponse(r interface{}) *blobbergrpc.CommitMetaTxnRe return &blobbergrpc.CommitMetaTxnResponse{Message: msg.Msg} } -func CollaboratorResponse(r interface{}) *blobbergrpc.CollaboratorResponse { +func CollaboratorResponseCreator(r interface{}) *blobbergrpc.CollaboratorResponse { if r == nil { return nil } @@ -369,4 +369,4 @@ func RenameObjectResponseCreator(r interface{}) *blobbergrpc.RenameObjectRespons UploadLength: httpResp.UploadLength, UploadOffset: httpResp.UploadOffset, } -} \ No newline at end of file +}