Use protocol-specific names for stream structures

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-08-21 15:14:50 +03:00 committed by Stanislav Bogatyrev
parent 5e25c76f40
commit e55b59bde7
2 changed files with 13 additions and 13 deletions

View file

@ -235,7 +235,7 @@ func newGRPCGetClient(c *object.Client) *getObjectClient {
if !ok { if !ok {
return nil, errors.New("can't convert interface to grpc get getClient") return nil, errors.New("can't convert interface to grpc get getClient")
} }
return &getObjectStream{ return &getObjectGRPCStream{
recv: func() (*GetResponse, error) { recv: func() (*GetResponse, error) {
resp, err := cli.Recv() resp, err := cli.Recv()
if err != nil { if err != nil {
@ -262,7 +262,7 @@ func newGRPCPutClient(c *object.Client) *putObjectClient {
return nil, errors.New("can't convert interface to grpc get getClient") return nil, errors.New("can't convert interface to grpc get getClient")
} }
return &putObjectStream{ return &putObjectGRPCStream{
send: func(request *PutRequest) error { send: func(request *PutRequest) error {
return cli.Send(PutRequestToGRPCMessage(request)) return cli.Send(PutRequestToGRPCMessage(request))
}, },
@ -305,7 +305,7 @@ func newGRPCSearchClient(c *object.Client) *searchObjectClient {
if !ok { if !ok {
return nil, errors.New("can't convert interface to grpc get getClient") return nil, errors.New("can't convert interface to grpc get getClient")
} }
return &searchObjectStream{ return &searchObjectGRPCStream{
recv: func() (*SearchResponse, error) { recv: func() (*SearchResponse, error) {
resp, err := cli.Recv() resp, err := cli.Recv()
if err != nil { if err != nil {
@ -345,7 +345,7 @@ func newGRPCGetRangeClient(c *object.Client) *getRangeObjectClient {
if !ok { if !ok {
return nil, errors.New("can't convert interface to grpc get getClient") return nil, errors.New("can't convert interface to grpc get getClient")
} }
return &getRangeObjectStream{ return &getRangeObjectGRPCStream{
recv: func() (*GetRangeResponse, error) { recv: func() (*GetRangeResponse, error) {
resp, err := cli.Recv() resp, err := cli.Recv()
if err != nil { if err != nil {

View file

@ -20,41 +20,41 @@ type (
) )
type ( type (
getObjectStream struct { getObjectGRPCStream struct {
recv func() (*GetResponse, error) recv func() (*GetResponse, error)
} }
putObjectStream struct { putObjectGRPCStream struct {
send func(*PutRequest) error send func(*PutRequest) error
closeAndRecv func() (*PutResponse, error) closeAndRecv func() (*PutResponse, error)
} }
searchObjectStream struct { searchObjectGRPCStream struct {
recv func() (*SearchResponse, error) recv func() (*SearchResponse, error)
} }
getRangeObjectStream struct { getRangeObjectGRPCStream struct {
recv func() (*GetRangeResponse, error) recv func() (*GetRangeResponse, error)
} }
) )
func (s *getObjectStream) Recv() (*GetResponse, error) { func (s *getObjectGRPCStream) Recv() (*GetResponse, error) {
return s.recv() return s.recv()
} }
func (p *putObjectStream) Send(request *PutRequest) error { func (p *putObjectGRPCStream) Send(request *PutRequest) error {
return p.send(request) return p.send(request)
} }
func (p *putObjectStream) CloseAndRecv() (*PutResponse, error) { func (p *putObjectGRPCStream) CloseAndRecv() (*PutResponse, error) {
return p.closeAndRecv() return p.closeAndRecv()
} }
func (s *searchObjectStream) Recv() (*SearchResponse, error) { func (s *searchObjectGRPCStream) Recv() (*SearchResponse, error) {
return s.recv() return s.recv()
} }
func (r *getRangeObjectStream) Recv() (*GetRangeResponse, error) { func (r *getRangeObjectGRPCStream) Recv() (*GetRangeResponse, error) {
return r.recv() return r.recv()
} }