diff --git a/v2/object/convert.go b/v2/object/convert.go index b742e0df..0517efa5 100644 --- a/v2/object/convert.go +++ b/v2/object/convert.go @@ -1,6 +1,8 @@ package object import ( + "fmt" + object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" "github.com/nspcc-dev/neofs-api-go/v2/refs" refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" @@ -44,7 +46,7 @@ func ShortHeaderToGRPCMessage(h *ShortHeader) *object.ShortHeader { TypeToGRPCField(h.GetObjectType()), ) - m.SetPayloadLength(h.GeyPayloadLength()) + m.SetPayloadLength(h.GetPayloadLength()) return m } @@ -320,3 +322,1227 @@ func ObjectFromGRPCMessage(m *object.Object) *Object { return o } + +func GetRequestBodyToGRPCMessage(r *GetRequestBody) *object.GetRequest_Body { + if r == nil { + return nil + } + + m := new(object.GetRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetRaw(r.GetRaw()) + + return m +} + +func GetRequestBodyFromGRPCMessage(m *object.GetRequest_Body) *GetRequestBody { + if m == nil { + return nil + } + + r := new(GetRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetRaw(m.GetRaw()) + + return r +} + +func GetRequestToGRPCMessage(r *GetRequest) *object.GetRequest { + if r == nil { + return nil + } + + m := new(object.GetRequest) + + m.SetBody( + GetRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func GetRequestFromGRPCMessage(m *object.GetRequest) *GetRequest { + if m == nil { + return nil + } + + r := new(GetRequest) + + r.SetBody( + GetRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetObjectPartInitToGRPCMessage(r *GetObjectPartInit) *object.GetResponse_Body_Init { + if r == nil { + return nil + } + + m := new(object.GetResponse_Body_Init) + + m.SetObjectId( + refs.ObjectIDToGRPCMessage(r.GetObjectID()), + ) + + m.SetSignature( + service.SignatureToGRPCMessage(r.GetSignature()), + ) + + m.SetHeader( + HeaderToGRPCMessage(r.GetHeader()), + ) + + return m +} + +func GetObjectPartInitFromGRPCMessage(m *object.GetResponse_Body_Init) *GetObjectPartInit { + if m == nil { + return nil + } + + r := new(GetObjectPartInit) + + r.SetObjectID( + refs.ObjectIDFromGRPCMessage(m.GetObjectId()), + ) + + r.SetSignature( + service.SignatureFromGRPCMessage(m.GetSignature()), + ) + + r.SetHeader( + HeaderFromGRPCMessage(m.GetHeader()), + ) + + return r +} + +func GetObjectPartChunkToGRPCMessage(r *GetObjectPartChunk) *object.GetResponse_Body_Chunk { + if r == nil { + return nil + } + + m := new(object.GetResponse_Body_Chunk) + + m.SetChunk(r.GetChunk()) + + return m +} + +func GetObjectPartChunkFromGRPCMessage(m *object.GetResponse_Body_Chunk) *GetObjectPartChunk { + if m == nil { + return nil + } + + r := new(GetObjectPartChunk) + + r.SetChunk(m.GetChunk()) + + return r +} + +func GetResponseBodyToGRPCMessage(r *GetResponseBody) *object.GetResponse_Body { + if r == nil { + return nil + } + + m := new(object.GetResponse_Body) + + switch v := r.GetObjectPart(); t := v.(type) { + case nil: + case *GetObjectPartInit: + m.SetInit( + GetObjectPartInitToGRPCMessage(t), + ) + case *GetObjectPartChunk: + m.SetChunk( + GetObjectPartChunkToGRPCMessage(t), + ) + default: + panic(fmt.Sprintf("unknown object part %T", t)) + } + + return m +} + +func GetResponseBodyFromGRPCMessage(m *object.GetResponse_Body) *GetResponseBody { + if m == nil { + return nil + } + + r := new(GetResponseBody) + + switch v := m.GetObjectPart().(type) { + case nil: + case *object.GetResponse_Body_Init_: + r.SetObjectPart( + GetObjectPartInitFromGRPCMessage(v.Init), + ) + case *object.GetResponse_Body_Chunk: + r.SetObjectPart( + GetObjectPartChunkFromGRPCMessage(v), + ) + default: + panic(fmt.Sprintf("unknown object part %T", v)) + } + + return r +} + +func GetResponseToGRPCMessage(r *GetResponse) *object.GetResponse { + if r == nil { + return nil + } + + m := new(object.GetResponse) + + m.SetBody( + GetResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func GetResponseFromGRPCMessage(m *object.GetResponse) *GetResponse { + if m == nil { + return nil + } + + r := new(GetResponse) + + r.SetBody( + GetResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func PutObjectPartInitToGRPCMessage(r *PutObjectPartInit) *object.PutRequest_Body_Init { + if r == nil { + return nil + } + + m := new(object.PutRequest_Body_Init) + + m.SetObjectId( + refs.ObjectIDToGRPCMessage(r.GetObjectID()), + ) + + m.SetSignature( + service.SignatureToGRPCMessage(r.GetSignature()), + ) + + m.SetHeader( + HeaderToGRPCMessage(r.GetHeader()), + ) + + m.SetCopiesNumber(r.GetCopiesNumber()) + + return m +} + +func PutObjectPartInitFromGRPCMessage(m *object.PutRequest_Body_Init) *PutObjectPartInit { + if m == nil { + return nil + } + + r := new(PutObjectPartInit) + + r.SetObjectID( + refs.ObjectIDFromGRPCMessage(m.GetObjectId()), + ) + + r.SetSignature( + service.SignatureFromGRPCMessage(m.GetSignature()), + ) + + r.SetHeader( + HeaderFromGRPCMessage(m.GetHeader()), + ) + + r.SetCopiesNumber(m.GetCopiesNumber()) + + return r +} + +func PutObjectPartChunkToGRPCMessage(r *PutObjectPartChunk) *object.PutRequest_Body_Chunk { + if r == nil { + return nil + } + + m := new(object.PutRequest_Body_Chunk) + + m.SetChunk(r.GetChunk()) + + return m +} + +func PutObjectPartChunkFromGRPCMessage(m *object.PutRequest_Body_Chunk) *PutObjectPartChunk { + if m == nil { + return nil + } + + r := new(PutObjectPartChunk) + + r.SetChunk(m.GetChunk()) + + return r +} + +func PutRequestBodyToGRPCMessage(r *PutRequestBody) *object.PutRequest_Body { + if r == nil { + return nil + } + + m := new(object.PutRequest_Body) + + switch v := r.GetObjectPart(); t := v.(type) { + case nil: + case *PutObjectPartInit: + m.SetInit( + PutObjectPartInitToGRPCMessage(t), + ) + case *PutObjectPartChunk: + m.SetChunk( + PutObjectPartChunkToGRPCMessage(t), + ) + default: + panic(fmt.Sprintf("unknown object part %T", t)) + } + + return m +} + +func PutRequestBodyFromGRPCMessage(m *object.PutRequest_Body) *PutRequestBody { + if m == nil { + return nil + } + + r := new(PutRequestBody) + + switch v := m.GetObjectPart().(type) { + case nil: + case *object.PutRequest_Body_Init_: + r.SetObjectPart( + PutObjectPartInitFromGRPCMessage(v.Init), + ) + case *object.PutRequest_Body_Chunk: + r.SetObjectPart( + PutObjectPartChunkFromGRPCMessage(v), + ) + default: + panic(fmt.Sprintf("unknown object part %T", v)) + } + + return r +} + +func PutRequestToGRPCMessage(r *PutRequest) *object.PutRequest { + if r == nil { + return nil + } + + m := new(object.PutRequest) + + m.SetBody( + PutRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func PutRequestFromGRPCMessage(m *object.PutRequest) *PutRequest { + if m == nil { + return nil + } + + r := new(PutRequest) + + r.SetBody( + PutRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func PutResponseBodyToGRPCMessage(r *PutResponseBody) *object.PutResponse_Body { + if r == nil { + return nil + } + + m := new(object.PutResponse_Body) + + m.SetObjectId( + refs.ObjectIDToGRPCMessage(r.GetObjectID()), + ) + + return m +} + +func PutResponseBodyFromGRPCMessage(m *object.PutResponse_Body) *PutResponseBody { + if m == nil { + return nil + } + + r := new(PutResponseBody) + + r.SetObjectID( + refs.ObjectIDFromGRPCMessage(m.GetObjectId()), + ) + + return r +} + +func PutResponseToGRPCMessage(r *PutResponse) *object.PutResponse { + if r == nil { + return nil + } + + m := new(object.PutResponse) + + m.SetBody( + PutResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func PutResponseFromGRPCMessage(m *object.PutResponse) *PutResponse { + if m == nil { + return nil + } + + r := new(PutResponse) + + r.SetBody( + PutResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func DeleteRequestBodyToGRPCMessage(r *DeleteRequestBody) *object.DeleteRequest_Body { + if r == nil { + return nil + } + + m := new(object.DeleteRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetOwnerId( + refs.OwnerIDToGRPCMessage(r.GetOwnerID()), + ) + + return m +} + +func DeleteRequestBodyFromGRPCMessage(m *object.DeleteRequest_Body) *DeleteRequestBody { + if m == nil { + return nil + } + + r := new(DeleteRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetOwnerID( + refs.OwnerIDFromGRPCMessage(m.GetOwnerId()), + ) + + return r +} + +func DeleteRequestToGRPCMessage(r *DeleteRequest) *object.DeleteRequest { + if r == nil { + return nil + } + + m := new(object.DeleteRequest) + + m.SetBody( + DeleteRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func DeleteRequestFromGRPCMessage(m *object.DeleteRequest) *DeleteRequest { + if m == nil { + return nil + } + + r := new(DeleteRequest) + + r.SetBody( + DeleteRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func DeleteResponseBodyToGRPCMessage(r *DeleteResponseBody) *object.DeleteResponse_Body { + if r == nil { + return nil + } + + m := new(object.DeleteResponse_Body) + + return m +} + +func DeleteResponseBodyFromGRPCMessage(m *object.DeleteResponse_Body) *DeleteResponseBody { + if m == nil { + return nil + } + + r := new(DeleteResponseBody) + + return r +} + +func DeleteResponseToGRPCMessage(r *DeleteResponse) *object.DeleteResponse { + if r == nil { + return nil + } + + m := new(object.DeleteResponse) + + m.SetBody( + DeleteResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func DeleteResponseFromGRPCMessage(m *object.DeleteResponse) *DeleteResponse { + if m == nil { + return nil + } + + r := new(DeleteResponse) + + r.SetBody( + DeleteResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func HeadRequestBodyToGRPCMessage(r *HeadRequestBody) *object.HeadRequest_Body { + if r == nil { + return nil + } + + m := new(object.HeadRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetMainOnly(r.GetMainOnly()) + + m.SetRaw(r.GetRaw()) + + return m +} + +func HeadRequestBodyFromGRPCMessage(m *object.HeadRequest_Body) *HeadRequestBody { + if m == nil { + return nil + } + + r := new(HeadRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetMainOnly(m.GetMainOnly()) + + r.SetRaw(m.GetRaw()) + + return r +} + +func HeadRequestToGRPCMessage(r *HeadRequest) *object.HeadRequest { + if r == nil { + return nil + } + + m := new(object.HeadRequest) + + m.SetBody( + HeadRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func HeadRequestFromGRPCMessage(m *object.HeadRequest) *HeadRequest { + if m == nil { + return nil + } + + r := new(HeadRequest) + + r.SetBody( + HeadRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetHeaderPartFullToGRPCMessage(r *GetHeaderPartFull) *object.HeadResponse_Body_Header { + if r == nil { + return nil + } + + m := new(object.HeadResponse_Body_Header) + + m.SetHeader( + HeaderToGRPCMessage(r.GetHeader()), + ) + + return m +} + +func GetHeaderPartFullFromGRPCMessage(m *object.HeadResponse_Body_Header) *GetHeaderPartFull { + if m == nil { + return nil + } + + r := new(GetHeaderPartFull) + + r.SetHeader( + HeaderFromGRPCMessage(m.GetHeader()), + ) + + return r +} + +func GetHeaderPartShortToGRPCMessage(r *GetHeaderPartShort) *object.HeadResponse_Body_ShortHeader { + if r == nil { + return nil + } + + m := new(object.HeadResponse_Body_ShortHeader) + + m.SetShortHeader( + ShortHeaderToGRPCMessage(r.GetShortHeader()), + ) + + return m +} + +func GetHeaderPartShortFromGRPCMessage(m *object.HeadResponse_Body_ShortHeader) *GetHeaderPartShort { + if m == nil { + return nil + } + + r := new(GetHeaderPartShort) + + r.SetShortHeader( + ShortHeaderFromGRPCMessage(m.GetShortHeader()), + ) + + return r +} + +func HeadResponseBodyToGRPCMessage(r *HeadResponseBody) *object.HeadResponse_Body { + if r == nil { + return nil + } + + m := new(object.HeadResponse_Body) + + switch v := r.GetHeaderPart(); t := v.(type) { + case nil: + case *GetHeaderPartFull: + m.SetHeader( + GetHeaderPartFullToGRPCMessage(t), + ) + case *GetHeaderPartShort: + m.SetShortHeader( + GetHeaderPartShortToGRPCMessage(t), + ) + default: + panic(fmt.Sprintf("unknown header part %T", t)) + } + + return m +} + +func HeadResponseBodyFromGRPCMessage(m *object.HeadResponse_Body) *HeadResponseBody { + if m == nil { + return nil + } + + r := new(HeadResponseBody) + + switch v := m.GetHead().(type) { + case nil: + case *object.HeadResponse_Body_Header: + r.SetHeaderPart( + GetHeaderPartFullFromGRPCMessage(v), + ) + case *object.HeadResponse_Body_ShortHeader: + r.SetHeaderPart( + GetHeaderPartShortFromGRPCMessage(v), + ) + default: + panic(fmt.Sprintf("unknown header part %T", v)) + } + + return r +} + +func HeadResponseToGRPCMessage(r *HeadResponse) *object.HeadResponse { + if r == nil { + return nil + } + + m := new(object.HeadResponse) + + m.SetBody( + HeadResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func HeadResponseFromGRPCMessage(m *object.HeadResponse) *HeadResponse { + if m == nil { + return nil + } + + r := new(HeadResponse) + + r.SetBody( + HeadResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func SearchFilterToGRPCMessage(f *SearchFilter) *object.SearchRequest_Body_Filter { + if f == nil { + return nil + } + + m := new(object.SearchRequest_Body_Filter) + + m.SetMatchType( + MatchTypeToGRPCField(f.GetMatchType()), + ) + + m.SetName(f.GetName()) + + m.SetValue(f.GetValue()) + + return m +} + +func SearchFilterFromGRPCMessage(m *object.SearchRequest_Body_Filter) *SearchFilter { + if m == nil { + return nil + } + + f := new(SearchFilter) + + f.SetMatchType( + MatchTypeFromGRPCField(m.GetMatchType()), + ) + + f.SetName(m.GetName()) + + f.SetValue(m.GetValue()) + + return f +} + +func SearchRequestBodyToGRPCMessage(r *SearchRequestBody) *object.SearchRequest_Body { + if r == nil { + return nil + } + + m := new(object.SearchRequest_Body) + + m.SetContainerId( + refs.ContainerIDToGRPCMessage(r.GetContainerID()), + ) + + m.SetVersion(r.GetVersion()) + + filters := r.GetFilters() + filterMsg := make([]*object.SearchRequest_Body_Filter, 0, len(filters)) + + for i := range filters { + filterMsg = append(filterMsg, SearchFilterToGRPCMessage(filters[i])) + } + + m.SetFilters(filterMsg) + + return m +} + +func SearchRequestBodyFromGRPCMessage(m *object.SearchRequest_Body) *SearchRequestBody { + if m == nil { + return nil + } + + r := new(SearchRequestBody) + + r.SetContainerID( + refs.ContainerIDFromGRPCMessage(m.GetContainerId()), + ) + + r.SetVersion(m.GetVersion()) + + filterMsg := m.GetFilters() + filters := make([]*SearchFilter, 0, len(filterMsg)) + + for i := range filterMsg { + filters = append(filters, SearchFilterFromGRPCMessage(filterMsg[i])) + } + + r.SetFilters(filters) + + return r +} + +func SearchRequestToGRPCMessage(r *SearchRequest) *object.SearchRequest { + if r == nil { + return nil + } + + m := new(object.SearchRequest) + + m.SetBody( + SearchRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func SearchRequestFromGRPCMessage(m *object.SearchRequest) *SearchRequest { + if m == nil { + return nil + } + + r := new(SearchRequest) + + r.SetBody( + SearchRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func SearchResponseBodyToGRPCMessage(r *SearchResponseBody) *object.SearchResponse_Body { + if r == nil { + return nil + } + + m := new(object.SearchResponse_Body) + + ids := r.GetIDList() + idMsg := make([]*refsGRPC.ObjectID, 0, len(ids)) + + for i := range ids { + idMsg = append(idMsg, refs.ObjectIDToGRPCMessage(ids[i])) + } + + m.SetIdList(idMsg) + + return m +} + +func SearchResponseBodyFromGRPCMessage(m *object.SearchResponse_Body) *SearchResponseBody { + if m == nil { + return nil + } + + r := new(SearchResponseBody) + + idMsg := m.GetIdList() + ids := make([]*refs.ObjectID, 0, len(idMsg)) + + for i := range idMsg { + ids = append(ids, refs.ObjectIDFromGRPCMessage(idMsg[i])) + } + + r.SetIDList(ids) + + return r +} + +func SearchResponseToGRPCMessage(r *SearchResponse) *object.SearchResponse { + if r == nil { + return nil + } + + m := new(object.SearchResponse) + + m.SetBody( + SearchResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func SearchResponseFromGRPCMessage(m *object.SearchResponse) *SearchResponse { + if m == nil { + return nil + } + + r := new(SearchResponse) + + r.SetBody( + SearchResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func RangeToGRPCMessage(r *Range) *object.Range { + if r == nil { + return nil + } + + m := new(object.Range) + + m.SetOffset(r.GetOffset()) + m.SetLength(r.GetLength()) + + return m +} + +func RangeFromGRPCMessage(m *object.Range) *Range { + if m == nil { + return nil + } + + r := new(Range) + + r.SetOffset(m.GetOffset()) + r.SetLength(m.GetLength()) + + return r +} + +func GetRangeRequestBodyToGRPCMessage(r *GetRangeRequestBody) *object.GetRangeRequest_Body { + if r == nil { + return nil + } + + m := new(object.GetRangeRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetRange( + RangeToGRPCMessage(r.GetRange()), + ) + + return m +} + +func GetRangeRequestBodyFromGRPCMessage(m *object.GetRangeRequest_Body) *GetRangeRequestBody { + if m == nil { + return nil + } + + r := new(GetRangeRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetRange( + RangeFromGRPCMessage(m.GetRange()), + ) + + return r +} + +func GetRangeRequestToGRPCMessage(r *GetRangeRequest) *object.GetRangeRequest { + if r == nil { + return nil + } + + m := new(object.GetRangeRequest) + + m.SetBody( + GetRangeRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func GetRangeRequestFromGRPCMessage(m *object.GetRangeRequest) *GetRangeRequest { + if m == nil { + return nil + } + + r := new(GetRangeRequest) + + r.SetBody( + GetRangeRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetRangeResponseBodyToGRPCMessage(r *GetRangeResponseBody) *object.GetRangeResponse_Body { + if r == nil { + return nil + } + + m := new(object.GetRangeResponse_Body) + + m.SetChunk(r.GetChunk()) + + return m +} + +func GetRangeResponseBodyFromGRPCMessage(m *object.GetRangeResponse_Body) *GetRangeResponseBody { + if m == nil { + return nil + } + + r := new(GetRangeResponseBody) + + r.SetChunk(m.GetChunk()) + + return r +} + +func GetRangeResponseToGRPCMessage(r *GetRangeResponse) *object.GetRangeResponse { + if r == nil { + return nil + } + + m := new(object.GetRangeResponse) + + m.SetBody( + GetRangeResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func GetRangeResponseFromGRPCMessage(m *object.GetRangeResponse) *GetRangeResponse { + if m == nil { + return nil + } + + r := new(GetRangeResponse) + + r.SetBody( + GetRangeResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} + +func GetRangeHashRequestBodyToGRPCMessage(r *GetRangeHashRequestBody) *object.GetRangeHashRequest_Body { + if r == nil { + return nil + } + + m := new(object.GetRangeHashRequest_Body) + + m.SetAddress( + refs.AddressToGRPCMessage(r.GetAddress()), + ) + + m.SetSalt(r.GetSalt()) + + rngs := r.GetRanges() + rngMsg := make([]*object.Range, 0, len(rngs)) + + for i := range rngs { + rngMsg = append(rngMsg, RangeToGRPCMessage(rngs[i])) + } + + m.SetRanges(rngMsg) + + return m +} + +func GetRangeHashRequestBodyFromGRPCMessage(m *object.GetRangeHashRequest_Body) *GetRangeHashRequestBody { + if m == nil { + return nil + } + + r := new(GetRangeHashRequestBody) + + r.SetAddress( + refs.AddressFromGRPCMessage(m.GetAddress()), + ) + + r.SetSalt(m.GetSalt()) + + rngMsg := m.GetRanges() + rngs := make([]*Range, 0, len(rngMsg)) + + for i := range rngMsg { + rngs = append(rngs, RangeFromGRPCMessage(rngMsg[i])) + } + + r.SetRanges(rngs) + + return r +} + +func GetRangeHashRequestToGRPCMessage(r *GetRangeHashRequest) *object.GetRangeHashRequest { + if r == nil { + return nil + } + + m := new(object.GetRangeHashRequest) + + m.SetBody( + GetRangeHashRequestBodyToGRPCMessage(r.GetBody()), + ) + + service.RequestHeadersToGRPC(r, m) + + return m +} + +func GetRangeHashRequestFromGRPCMessage(m *object.GetRangeHashRequest) *GetRangeHashRequest { + if m == nil { + return nil + } + + r := new(GetRangeHashRequest) + + r.SetBody( + GetRangeHashRequestBodyFromGRPCMessage(m.GetBody()), + ) + + service.RequestHeadersFromGRPC(m, r) + + return r +} + +func GetRangeHashResponseBodyToGRPCMessage(r *GetRangeHashResponseBody) *object.GetRangeHashResponse_Body { + if r == nil { + return nil + } + + m := new(object.GetRangeHashResponse_Body) + + m.SetHashList(r.GetHashList()) + + return m +} + +func GetRangeHashResponseBodyFromGRPCMessage(m *object.GetRangeHashResponse_Body) *GetRangeHashResponseBody { + if m == nil { + return nil + } + + r := new(GetRangeHashResponseBody) + + r.SetHashList(m.GetHashList()) + + return r +} + +func GetRangeHashResponseToGRPCMessage(r *GetRangeHashResponse) *object.GetRangeHashResponse { + if r == nil { + return nil + } + + m := new(object.GetRangeHashResponse) + + m.SetBody( + GetRangeHashResponseBodyToGRPCMessage(r.GetBody()), + ) + + service.ResponseHeadersToGRPC(r, m) + + return m +} + +func GetRangeHashResponseFromGRPCMessage(m *object.GetRangeHashResponse) *GetRangeHashResponse { + if m == nil { + return nil + } + + r := new(GetRangeHashResponse) + + r.SetBody( + GetRangeHashResponseBodyFromGRPCMessage(m.GetBody()), + ) + + service.ResponseHeadersFromGRPC(m, r) + + return r +} diff --git a/v2/object/grpc/service.go b/v2/object/grpc/service.go index 1b955007..09e058ad 100644 --- a/v2/object/grpc/service.go +++ b/v2/object/grpc/service.go @@ -61,6 +61,22 @@ func (m *GetResponse_Body_Init) SetHeader(v *Header) { } } +// GetChunk returns chunk of the object payload bytes. +func (m *GetResponse_Body_Chunk) GetChunk() []byte { + if m != nil { + return m.Chunk + } + + return nil +} + +// SetChunk sets chunk of the object payload bytes. +func (m *GetResponse_Body_Chunk) SetChunk(v []byte) { + if m != nil { + m.Chunk = v + } +} + // SetInit sets initial part of the object. func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { if m != nil { @@ -70,12 +86,10 @@ func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { } } -// SetChunk sets chunk of the object payload bytes. -func (m *GetResponse_Body) SetChunk(v []byte) { +// SetChunk sets part of the object payload. +func (m *GetResponse_Body) SetChunk(v *GetResponse_Body_Chunk) { if m != nil { - m.ObjectPart = &GetResponse_Body_Chunk{ - Chunk: v, - } + m.ObjectPart = v } } @@ -128,6 +142,22 @@ func (m *PutRequest_Body_Init) SetCopiesNumber(v uint32) { } } +// GetChunk returns chunk of the object payload bytes. +func (m *PutRequest_Body_Chunk) GetChunk() []byte { + if m != nil { + return m.Chunk + } + + return nil +} + +// SetChunk sets chunk of the object payload bytes. +func (m *PutRequest_Body_Chunk) SetChunk(v []byte) { + if m != nil { + m.Chunk = v + } +} + // SetInit sets initial part of the object. func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { if m != nil { @@ -137,12 +167,10 @@ func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { } } -// SetChunk sets chunk of the object paloyad bytes. -func (m *PutRequest_Body) SetChunk(v []byte) { +// SetChunk sets part of the object payload. +func (m *PutRequest_Body) SetChunk(v *PutRequest_Body_Chunk) { if m != nil { - m.ObjectPart = &PutRequest_Body_Chunk{ - Chunk: v, - } + m.ObjectPart = v } } @@ -251,8 +279,8 @@ func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) } } -// SetOwnerId sets identifier of the object with the requested header. -func (m *HeadRequest_Body) SetOwnerId(v *refs.Address) { +// SetAddress sets address of the object with the requested header. +func (m *HeadRequest_Body) SetAddress(v *refs.Address) { if m != nil { m.Address = v } @@ -293,47 +321,42 @@ func (m *HeadRequest) SetVerifyHeader(v *service.RequestVerificationHeader) { } } -// SetVersion sets version of the object format. -func (m *HeadResponse_Body_ShortHeader) SetVersion(v *service.Version) { +// GetShortHeader returns short header of the object. +func (m *HeadResponse_Body_ShortHeader) GetShortHeader() *ShortHeader { if m != nil { - m.ShortHeader.Version = v + return m.ShortHeader + } + + return nil +} + +// SetShortHeader sets short header of the object. +func (m *HeadResponse_Body_ShortHeader) SetShortHeader(v *ShortHeader) { + if m != nil { + m.ShortHeader = v } } -// SetCreationEpoch sets creation epoch number of the object. -func (m *HeadResponse_Body_ShortHeader) SetCreationEpoch(v uint64) { +// GetHeader returns object header. +func (m *HeadResponse_Body_Header) GetHeader() *Header { if m != nil { - m.ShortHeader.CreationEpoch = v + return m.Header } + + return nil } -// SetOwnerId sets identifier of the object owner. -func (m *HeadResponse_Body_ShortHeader) SetOwnerId(v *refs.OwnerID) { +// SetHeader sets object header. +func (m *HeadResponse_Body_Header) SetHeader(v *Header) { if m != nil { - m.ShortHeader.OwnerId = v - } -} - -// SetObjectType sets type of the object. -func (m *HeadResponse_Body_ShortHeader) SetObjectType(v ObjectType) { - if m != nil { - m.ShortHeader.ObjectType = v - } -} - -// SetPayloadLength sets length of the object payload. -func (m *HeadResponse_Body_ShortHeader) SetPayloadLength(v uint64) { - if m != nil { - m.ShortHeader.PayloadLength = v + m.Header = v } } // SetHeader sets full header of the object. -func (m *HeadResponse_Body) SetHeader(v *Header) { +func (m *HeadResponse_Body) SetHeader(v *HeadResponse_Body_Header) { if m != nil { - m.Head = &HeadResponse_Body_Header{ - Header: v, - } + m.Head = v } } @@ -574,3 +597,31 @@ func (m *GetRangeHashRequest) SetVerifyHeader(v *service.RequestVerificationHead m.VerifyHeader = v } } + +// SetHashList returns list of the range hashes. +func (m *GetRangeHashResponse_Body) SetHashList(v [][]byte) { + if m != nil { + m.HashList = v + } +} + +// SetBody sets body of the response. +func (m *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (m *GetRangeHashResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if m != nil { + m.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (m *GetRangeHashResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) { + if m != nil { + m.VerifyHeader = v + } +} diff --git a/v2/object/types.go b/v2/object/types.go index 191457b2..3ed9f391 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -67,6 +67,244 @@ type Object struct { payload []byte } +type GetRequestBody struct { + addr *refs.Address + + raw bool +} + +type GetRequest struct { + body *GetRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetObjectPart interface { + getObjectPart() +} + +type GetObjectPartInit struct { + id *refs.ObjectID + + sig *service.Signature + + hdr *Header +} + +type GetObjectPartChunk struct { + chunk []byte +} + +type GetResponseBody struct { + objPart GetObjectPart +} + +type GetResponse struct { + body *GetResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type PutObjectPart interface { + putObjectPart() +} + +type PutObjectPartInit struct { + id *refs.ObjectID + + sig *service.Signature + + hdr *Header + + copyNum uint32 +} + +type PutObjectPartChunk struct { + chunk []byte +} + +type PutRequestBody struct { + objPart PutObjectPart +} + +type PutRequest struct { + body *PutRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type PutResponseBody struct { + id *refs.ObjectID +} + +type PutResponse struct { + body *PutResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type DeleteRequestBody struct { + addr *refs.Address + + ownerID *refs.OwnerID +} + +type DeleteRequest struct { + body *DeleteRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type DeleteResponseBody struct{} + +type DeleteResponse struct { + body *DeleteResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type HeadRequestBody struct { + addr *refs.Address + + mainOnly, raw bool +} + +type HeadRequest struct { + body *HeadRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetHeaderPart interface { + getHeaderPart() +} + +type GetHeaderPartFull struct { + hdr *Header +} + +type GetHeaderPartShort struct { + hdr *ShortHeader +} + +type HeadResponseBody struct { + hdrPart GetHeaderPart +} + +type HeadResponse struct { + body *HeadResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type SearchFilter struct { + matchType MatchType + + name, val string +} + +type SearchRequestBody struct { + cid *refs.ContainerID + + version uint32 + + filters []*SearchFilter +} + +type SearchRequest struct { + body *SearchRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type SearchResponseBody struct { + idList []*refs.ObjectID +} + +type SearchResponse struct { + body *SearchResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type Range struct { + off, len uint64 +} + +type GetRangeRequestBody struct { + addr *refs.Address + + rng *Range +} + +type GetRangeRequest struct { + body *GetRangeRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetRangeResponseBody struct { + chunk []byte +} + +type GetRangeResponse struct { + body *GetRangeResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + +type GetRangeHashRequestBody struct { + addr *refs.Address + + rngs []*Range + + salt []byte +} + +type GetRangeHashRequest struct { + body *GetRangeHashRequestBody + + metaHeader *service.RequestMetaHeader + + verifyHeader *service.RequestVerificationHeader +} + +type GetRangeHashResponseBody struct { + hashList [][]byte +} + +type GetRangeHashResponse struct { + body *GetRangeHashResponseBody + + metaHeader *service.ResponseMetaHeader + + verifyHeader *service.ResponseVerificationHeader +} + const ( TypeRegular Type = iota TypeTombstone @@ -134,7 +372,7 @@ func (h *ShortHeader) SetObjectType(v Type) { } } -func (h *ShortHeader) GeyPayloadLength() uint64 { +func (h *ShortHeader) GetPayloadLength() uint64 { if h != nil { return h.payloadLen } @@ -455,3 +693,1135 @@ func (o *Object) SetPayload(v []byte) { o.payload = v } } + +func (r *GetRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *GetRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *GetRequestBody) GetRaw() bool { + if r != nil { + return r.raw + } + + return false +} + +func (r *GetRequestBody) SetRaw(v bool) { + if r != nil { + r.raw = v + } +} + +func (r *GetRequest) GetBody() *GetRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRequest) SetBody(v *GetRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetObjectPartInit) GetObjectID() *refs.ObjectID { + if r != nil { + return r.id + } + + return nil +} + +func (r *GetObjectPartInit) SetObjectID(v *refs.ObjectID) { + if r != nil { + r.id = v + } +} + +func (r *GetObjectPartInit) GetSignature() *service.Signature { + if r != nil { + return r.sig + } + + return nil +} + +func (r *GetObjectPartInit) SetSignature(v *service.Signature) { + if r != nil { + r.sig = v + } +} + +func (r *GetObjectPartInit) GetHeader() *Header { + if r != nil { + return r.hdr + } + + return nil +} + +func (r *GetObjectPartInit) SetHeader(v *Header) { + if r != nil { + r.hdr = v + } +} + +func (r *GetObjectPartInit) getObjectPart() {} + +func (r *GetObjectPartChunk) GetChunk() []byte { + if r != nil { + return r.chunk + } + + return nil +} + +func (r *GetObjectPartChunk) SetChunk(v []byte) { + if r != nil { + r.chunk = v + } +} + +func (r *GetObjectPartChunk) getObjectPart() {} + +func (r *GetResponseBody) GetObjectPart() GetObjectPart { + if r != nil { + return r.objPart + } + + return nil +} + +func (r *GetResponseBody) SetObjectPart(v GetObjectPart) { + if r != nil { + r.objPart = v + } +} + +func (r *GetResponse) GetBody() *GetResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetResponse) SetBody(v *GetResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *GetResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *PutObjectPartInit) GetObjectID() *refs.ObjectID { + if r != nil { + return r.id + } + + return nil +} + +func (r *PutObjectPartInit) SetObjectID(v *refs.ObjectID) { + if r != nil { + r.id = v + } +} + +func (r *PutObjectPartInit) GetSignature() *service.Signature { + if r != nil { + return r.sig + } + + return nil +} + +func (r *PutObjectPartInit) SetSignature(v *service.Signature) { + if r != nil { + r.sig = v + } +} + +func (r *PutObjectPartInit) GetHeader() *Header { + if r != nil { + return r.hdr + } + + return nil +} + +func (r *PutObjectPartInit) SetHeader(v *Header) { + if r != nil { + r.hdr = v + } +} + +func (r *PutObjectPartInit) GetCopiesNumber() uint32 { + if r != nil { + return r.copyNum + } + + return 0 +} + +func (r *PutObjectPartInit) SetCopiesNumber(v uint32) { + if r != nil { + r.copyNum = v + } +} + +func (r *PutObjectPartInit) putObjectPart() {} + +func (r *PutObjectPartChunk) GetChunk() []byte { + if r != nil { + return r.chunk + } + + return nil +} + +func (r *PutObjectPartChunk) SetChunk(v []byte) { + if r != nil { + r.chunk = v + } +} + +func (r *PutObjectPartChunk) putObjectPart() {} + +func (r *PutRequestBody) GetObjectPart() PutObjectPart { + if r != nil { + return r.objPart + } + + return nil +} + +func (r *PutRequestBody) SetObjectPart(v PutObjectPart) { + if r != nil { + r.objPart = v + } +} + +func (r *PutRequest) GetBody() *PutRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutRequest) SetBody(v *PutRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *PutRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *PutRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *PutRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *PutResponseBody) GetObjectID() *refs.ObjectID { + if r != nil { + return r.id + } + + return nil +} + +func (r *PutResponseBody) SetObjectID(v *refs.ObjectID) { + if r != nil { + r.id = v + } +} + +func (r *PutResponse) GetBody() *PutResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutResponse) SetBody(v *PutResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *PutResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *PutResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *PutResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *DeleteRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *DeleteRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *DeleteRequestBody) GetOwnerID() *refs.OwnerID { + if r != nil { + return r.ownerID + } + + return nil +} + +func (r *DeleteRequestBody) SetOwnerID(v *refs.OwnerID) { + if r != nil { + r.ownerID = v + } +} + +func (r *DeleteRequest) GetBody() *DeleteRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *DeleteRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *DeleteRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *DeleteRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *DeleteResponse) GetBody() *DeleteResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *DeleteResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *DeleteResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *DeleteResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *HeadRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *HeadRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *HeadRequestBody) GetMainOnly() bool { + if r != nil { + return r.mainOnly + } + + return false +} + +func (r *HeadRequestBody) SetMainOnly(v bool) { + if r != nil { + r.mainOnly = v + } +} + +func (r *HeadRequestBody) GetRaw() bool { + if r != nil { + return r.raw + } + + return false +} + +func (r *HeadRequestBody) SetRaw(v bool) { + if r != nil { + r.raw = v + } +} + +func (r *HeadRequest) GetBody() *HeadRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *HeadRequest) SetBody(v *HeadRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *HeadRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *HeadRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *HeadRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *HeadRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (h *GetHeaderPartFull) GetHeader() *Header { + if h != nil { + return h.hdr + } + + return nil +} + +func (h *GetHeaderPartFull) SetHeader(v *Header) { + if h != nil { + h.hdr = v + } +} + +func (*GetHeaderPartFull) getHeaderPart() {} + +func (h *GetHeaderPartShort) GetShortHeader() *ShortHeader { + if h != nil { + return h.hdr + } + + return nil +} + +func (h *GetHeaderPartShort) SetShortHeader(v *ShortHeader) { + if h != nil { + h.hdr = v + } +} + +func (*GetHeaderPartShort) getHeaderPart() {} + +func (r *HeadResponseBody) GetHeaderPart() GetHeaderPart { + if r != nil { + return r.hdrPart + } + + return nil +} + +func (r *HeadResponseBody) SetHeaderPart(v GetHeaderPart) { + if r != nil { + r.hdrPart = v + } +} + +func (r *HeadResponse) GetBody() *HeadResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *HeadResponse) SetBody(v *HeadResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *HeadResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *HeadResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *HeadResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *HeadResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (f *SearchFilter) GetMatchType() MatchType { + if f != nil { + return f.matchType + } + + return MatchUnknown +} + +func (f *SearchFilter) SetMatchType(v MatchType) { + if f != nil { + f.matchType = v + } +} + +func (f *SearchFilter) GetName() string { + if f != nil { + return f.name + } + + return "" +} + +func (f *SearchFilter) SetName(v string) { + if f != nil { + f.name = v + } +} + +func (f *SearchFilter) GetValue() string { + if f != nil { + return f.val + } + + return "" +} + +func (f *SearchFilter) SetValue(v string) { + if f != nil { + f.val = v + } +} + +func (r *SearchRequestBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *SearchRequestBody) SetContainerID(v *refs.ContainerID) { + if r != nil { + r.cid = v + } +} + +func (r *SearchRequestBody) GetVersion() uint32 { + if r != nil { + return r.version + } + + return 0 +} + +func (r *SearchRequestBody) SetVersion(v uint32) { + if r != nil { + r.version = v + } +} + +func (r *SearchRequestBody) GetFilters() []*SearchFilter { + if r != nil { + return r.filters + } + + return nil +} + +func (r *SearchRequestBody) SetFilters(v []*SearchFilter) { + if r != nil { + r.filters = v + } +} + +func (r *SearchRequest) GetBody() *SearchRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *SearchRequest) SetBody(v *SearchRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *SearchRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *SearchRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *SearchRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *SearchRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *SearchResponseBody) GetIDList() []*refs.ObjectID { + if r != nil { + return r.idList + } + + return nil +} + +func (r *SearchResponseBody) SetIDList(v []*refs.ObjectID) { + if r != nil { + r.idList = v + } +} + +func (r *SearchResponse) GetBody() *SearchResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *SearchResponse) SetBody(v *SearchResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *SearchResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *SearchResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *SearchResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *SearchResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *Range) GetOffset() uint64 { + if r != nil { + return r.off + } + + return 0 +} + +func (r *Range) SetOffset(v uint64) { + if r != nil { + r.off = v + } +} + +func (r *Range) GetLength() uint64 { + if r != nil { + return r.len + } + + return 0 +} + +func (r *Range) SetLength(v uint64) { + if r != nil { + r.len = v + } +} + +func (r *GetRangeRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *GetRangeRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *GetRangeRequestBody) GetRange() *Range { + if r != nil { + return r.rng + } + + return nil +} + +func (r *GetRangeRequestBody) SetRange(v *Range) { + if r != nil { + r.rng = v + } +} + +func (r *GetRangeRequest) GetBody() *GetRangeRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeRequest) SetBody(v *GetRangeRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRangeRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRangeRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRangeRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRangeRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetRangeResponseBody) GetChunk() []byte { + if r != nil { + return r.chunk + } + + return nil +} + +func (r *GetRangeResponseBody) SetChunk(v []byte) { + if r != nil { + r.chunk = v + } +} + +func (r *GetRangeResponse) GetBody() *GetRangeResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeResponse) SetBody(v *GetRangeResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRangeResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRangeResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRangeResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRangeResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetRangeHashRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *GetRangeHashRequestBody) SetAddress(v *refs.Address) { + if r != nil { + r.addr = v + } +} + +func (r *GetRangeHashRequestBody) GetRanges() []*Range { + if r != nil { + return r.rngs + } + + return nil +} + +func (r *GetRangeHashRequestBody) SetRanges(v []*Range) { + if r != nil { + r.rngs = v + } +} + +func (r *GetRangeHashRequestBody) GetSalt() []byte { + if r != nil { + return r.salt + } + + return nil +} + +func (r *GetRangeHashRequestBody) SetSalt(v []byte) { + if r != nil { + r.salt = v + } +} + +func (r *GetRangeHashRequest) GetBody() *GetRangeHashRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeHashRequest) SetBody(v *GetRangeHashRequestBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRangeHashRequest) GetMetaHeader() *service.RequestMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRangeHashRequest) SetMetaHeader(v *service.RequestMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRangeHashRequest) GetVerificationHeader() *service.RequestVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRangeHashRequest) SetVerificationHeader(v *service.RequestVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +} + +func (r *GetRangeHashResponseBody) GetHashList() [][]byte { + if r != nil { + return r.hashList + } + + return nil +} + +func (r *GetRangeHashResponseBody) SetHashList(v [][]byte) { + if r != nil { + r.hashList = v + } +} + +func (r *GetRangeHashResponse) GetBody() *GetRangeHashResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeHashResponse) SetBody(v *GetRangeHashResponseBody) { + if r != nil { + r.body = v + } +} + +func (r *GetRangeHashResponse) GetMetaHeader() *service.ResponseMetaHeader { + if r != nil { + return r.metaHeader + } + + return nil +} + +func (r *GetRangeHashResponse) SetMetaHeader(v *service.ResponseMetaHeader) { + if r != nil { + r.metaHeader = v + } +} + +func (r *GetRangeHashResponse) GetVerificationHeader() *service.ResponseVerificationHeader { + if r != nil { + return r.verifyHeader + } + + return nil +} + +func (r *GetRangeHashResponse) SetVerificationHeader(v *service.ResponseVerificationHeader) { + if r != nil { + r.verifyHeader = v + } +}