Split object service structs from types

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-08-21 15:59:30 +03:00 committed by Stanislav Bogatyrev
parent ae1c1a351c
commit ecb0a4be67
2 changed files with 114 additions and 112 deletions

View file

@ -2,6 +2,8 @@ package object
import ( import (
"context" "context"
"github.com/nspcc-dev/neofs-api-go/v2/session"
) )
type Service interface { type Service interface {
@ -13,3 +15,115 @@ type Service interface {
GetRange(context.Context, *GetRangeRequest) (GetRangeObjectStreamer, error) GetRange(context.Context, *GetRangeRequest) (GetRangeObjectStreamer, error)
GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, 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
}

View file

@ -73,14 +73,6 @@ type GetRequestBody struct {
raw bool raw bool
} }
type GetRequest struct {
body *GetRequestBody
metaHeader *session.RequestMetaHeader
verifyHeader *session.RequestVerificationHeader
}
type GetObjectPart interface { type GetObjectPart interface {
getObjectPart() getObjectPart()
} }
@ -101,14 +93,6 @@ type GetResponseBody struct {
objPart GetObjectPart objPart GetObjectPart
} }
type GetResponse struct {
body *GetResponseBody
metaHeader *session.ResponseMetaHeader
verifyHeader *session.ResponseVerificationHeader
}
type PutObjectPart interface { type PutObjectPart interface {
putObjectPart() putObjectPart()
} }
@ -131,62 +115,22 @@ type PutRequestBody struct {
objPart PutObjectPart objPart PutObjectPart
} }
type PutRequest struct {
body *PutRequestBody
metaHeader *session.RequestMetaHeader
verifyHeader *session.RequestVerificationHeader
}
type PutResponseBody struct { type PutResponseBody struct {
id *refs.ObjectID id *refs.ObjectID
} }
type PutResponse struct {
body *PutResponseBody
metaHeader *session.ResponseMetaHeader
verifyHeader *session.ResponseVerificationHeader
}
type DeleteRequestBody struct { type DeleteRequestBody struct {
addr *refs.Address addr *refs.Address
} }
type DeleteRequest struct {
body *DeleteRequestBody
metaHeader *session.RequestMetaHeader
verifyHeader *session.RequestVerificationHeader
}
type DeleteResponseBody struct{} type DeleteResponseBody struct{}
type DeleteResponse struct {
body *DeleteResponseBody
metaHeader *session.ResponseMetaHeader
verifyHeader *session.ResponseVerificationHeader
}
type HeadRequestBody struct { type HeadRequestBody struct {
addr *refs.Address addr *refs.Address
mainOnly, raw bool mainOnly, raw bool
} }
type HeadRequest struct {
body *HeadRequestBody
metaHeader *session.RequestMetaHeader
verifyHeader *session.RequestVerificationHeader
}
type GetHeaderPart interface { type GetHeaderPart interface {
getHeaderPart() getHeaderPart()
} }
@ -203,14 +147,6 @@ type HeadResponseBody struct {
hdrPart GetHeaderPart hdrPart GetHeaderPart
} }
type HeadResponse struct {
body *HeadResponseBody
metaHeader *session.ResponseMetaHeader
verifyHeader *session.ResponseVerificationHeader
}
type SearchFilter struct { type SearchFilter struct {
matchType MatchType matchType MatchType
@ -225,26 +161,10 @@ type SearchRequestBody struct {
filters []*SearchFilter filters []*SearchFilter
} }
type SearchRequest struct {
body *SearchRequestBody
metaHeader *session.RequestMetaHeader
verifyHeader *session.RequestVerificationHeader
}
type SearchResponseBody struct { type SearchResponseBody struct {
idList []*refs.ObjectID idList []*refs.ObjectID
} }
type SearchResponse struct {
body *SearchResponseBody
metaHeader *session.ResponseMetaHeader
verifyHeader *session.ResponseVerificationHeader
}
type Range struct { type Range struct {
off, len uint64 off, len uint64
} }
@ -255,26 +175,10 @@ type GetRangeRequestBody struct {
rng *Range rng *Range
} }
type GetRangeRequest struct {
body *GetRangeRequestBody
metaHeader *session.RequestMetaHeader
verifyHeader *session.RequestVerificationHeader
}
type GetRangeResponseBody struct { type GetRangeResponseBody struct {
chunk []byte chunk []byte
} }
type GetRangeResponse struct {
body *GetRangeResponseBody
metaHeader *session.ResponseMetaHeader
verifyHeader *session.ResponseVerificationHeader
}
type GetRangeHashRequestBody struct { type GetRangeHashRequestBody struct {
addr *refs.Address addr *refs.Address
@ -285,28 +189,12 @@ type GetRangeHashRequestBody struct {
typ refs.ChecksumType typ refs.ChecksumType
} }
type GetRangeHashRequest struct {
body *GetRangeHashRequestBody
metaHeader *session.RequestMetaHeader
verifyHeader *session.RequestVerificationHeader
}
type GetRangeHashResponseBody struct { type GetRangeHashResponseBody struct {
typ refs.ChecksumType typ refs.ChecksumType
hashList [][]byte hashList [][]byte
} }
type GetRangeHashResponse struct {
body *GetRangeHashResponseBody
metaHeader *session.ResponseMetaHeader
verifyHeader *session.ResponseVerificationHeader
}
const ( const (
TypeRegular Type = iota TypeRegular Type = iota
TypeTombstone TypeTombstone