frostfs-node/pkg/services/object/search/v2/streamer.go
Leonard Lyubich f15e6e888f [#1377] oid, cid: Upgrade SDK package
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-05-16 15:33:22 +03:00

29 lines
602 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 {
ids[i].WriteToV2(&idsV2[i])
}
body.SetIDList(idsV2)
return s.stream.Send(r)
}