From ecb0a4be6719359bbe9410894df496feeddcd710 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 21 Aug 2020 15:59:30 +0300 Subject: [PATCH] Split object service structs from types Signed-off-by: Alex Vanin --- v2/object/service.go | 114 +++++++++++++++++++++++++++++++++++++++++++ v2/object/types.go | 112 ------------------------------------------ 2 files changed, 114 insertions(+), 112 deletions(-) diff --git a/v2/object/service.go b/v2/object/service.go index 1551aee5..2bf69c88 100644 --- a/v2/object/service.go +++ b/v2/object/service.go @@ -2,6 +2,8 @@ package object import ( "context" + + "github.com/nspcc-dev/neofs-api-go/v2/session" ) type Service interface { @@ -13,3 +15,115 @@ type Service interface { GetRange(context.Context, *GetRangeRequest) (GetRangeObjectStreamer, error) GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) } + +type GetRequest struct { + body *GetRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type GetResponse struct { + body *GetResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type PutRequest struct { + body *PutRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type PutResponse struct { + body *PutResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type DeleteRequest struct { + body *DeleteRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type DeleteResponse struct { + body *DeleteResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type HeadRequest struct { + body *HeadRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type HeadResponse struct { + body *HeadResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type SearchRequest struct { + body *SearchRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type SearchResponse struct { + body *SearchResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type GetRangeRequest struct { + body *GetRangeRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type GetRangeResponse struct { + body *GetRangeResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} + +type GetRangeHashRequest struct { + body *GetRangeHashRequestBody + + metaHeader *session.RequestMetaHeader + + verifyHeader *session.RequestVerificationHeader +} + +type GetRangeHashResponse struct { + body *GetRangeHashResponseBody + + metaHeader *session.ResponseMetaHeader + + verifyHeader *session.ResponseVerificationHeader +} diff --git a/v2/object/types.go b/v2/object/types.go index d1328f89..cdce248d 100644 --- a/v2/object/types.go +++ b/v2/object/types.go @@ -73,14 +73,6 @@ type GetRequestBody struct { raw bool } -type GetRequest struct { - body *GetRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type GetObjectPart interface { getObjectPart() } @@ -101,14 +93,6 @@ type GetResponseBody struct { objPart GetObjectPart } -type GetResponse struct { - body *GetResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type PutObjectPart interface { putObjectPart() } @@ -131,62 +115,22 @@ type PutRequestBody struct { objPart PutObjectPart } -type PutRequest struct { - body *PutRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type PutResponseBody struct { id *refs.ObjectID } -type PutResponse struct { - body *PutResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type DeleteRequestBody struct { addr *refs.Address } -type DeleteRequest struct { - body *DeleteRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type DeleteResponseBody struct{} -type DeleteResponse struct { - body *DeleteResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type HeadRequestBody struct { addr *refs.Address mainOnly, raw bool } -type HeadRequest struct { - body *HeadRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type GetHeaderPart interface { getHeaderPart() } @@ -203,14 +147,6 @@ type HeadResponseBody struct { hdrPart GetHeaderPart } -type HeadResponse struct { - body *HeadResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type SearchFilter struct { matchType MatchType @@ -225,26 +161,10 @@ type SearchRequestBody struct { filters []*SearchFilter } -type SearchRequest struct { - body *SearchRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type SearchResponseBody struct { idList []*refs.ObjectID } -type SearchResponse struct { - body *SearchResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type Range struct { off, len uint64 } @@ -255,26 +175,10 @@ type GetRangeRequestBody struct { rng *Range } -type GetRangeRequest struct { - body *GetRangeRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type GetRangeResponseBody struct { chunk []byte } -type GetRangeResponse struct { - body *GetRangeResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - type GetRangeHashRequestBody struct { addr *refs.Address @@ -285,28 +189,12 @@ type GetRangeHashRequestBody struct { typ refs.ChecksumType } -type GetRangeHashRequest struct { - body *GetRangeHashRequestBody - - metaHeader *session.RequestMetaHeader - - verifyHeader *session.RequestVerificationHeader -} - type GetRangeHashResponseBody struct { typ refs.ChecksumType hashList [][]byte } -type GetRangeHashResponse struct { - body *GetRangeHashResponseBody - - metaHeader *session.ResponseMetaHeader - - verifyHeader *session.ResponseVerificationHeader -} - const ( TypeRegular Type = iota TypeTombstone