frostfs-node/pkg/services/object/search/v2/streamer.go
Pavel Karpy 1667ec9e6d [] *: Adopt SDK changes
`object.Address` has been moved to `object/address`
`object.ID` has been moved to `object/id`

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-08 09:45:38 +03:00

29 lines
601 B
Go

package searchsvc
import (
"github.com/nspcc-dev/neofs-api-go/v2/object"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
objectSvc "github.com/nspcc-dev/neofs-node/pkg/services/object"
oidSDK "github.com/nspcc-dev/neofs-sdk-go/object/id"
)
type streamWriter struct {
stream objectSvc.SearchStream
}
func (s *streamWriter) WriteIDs(ids []*oidSDK.ID) error {
r := new(object.SearchResponse)
body := new(object.SearchResponseBody)
r.SetBody(body)
idsV2 := make([]*refs.ObjectID, len(ids))
for i := range ids {
idsV2[i] = ids[i].ToV2()
}
body.SetIDList(idsV2)
return s.stream.Send(r)
}