frostfs-node/pkg/services/object/search/v2/streamer.go
Leonard Lyubich 09084a7bff [#34] service/object: Implement object Search distributed service
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-02 11:25:35 +03:00

26 lines
523 B
Go

package searchsvc
import (
"io"
"github.com/nspcc-dev/neofs-api-go/v2/object"
searchsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/search"
"github.com/pkg/errors"
)
type streamer struct {
stream *searchsvc.Streamer
}
func (s *streamer) Recv() (*object.SearchResponse, error) {
r, err := s.stream.Recv()
if err != nil {
if errors.Is(errors.Cause(err), io.EOF) {
return nil, io.EOF
}
return nil, errors.Wrapf(err, "(%T) could not receive search response", s)
}
return fromResponse(r), nil
}