2020-09-22 06:51:47 +00:00
|
|
|
package searchsvc
|
|
|
|
|
|
|
|
import (
|
2020-12-10 12:26:40 +00:00
|
|
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
2020-09-22 06:51:47 +00:00
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
2020-12-10 12:26:40 +00:00
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
|
|
|
objectSvc "github.com/nspcc-dev/neofs-node/pkg/services/object"
|
2020-09-22 06:51:47 +00:00
|
|
|
)
|
|
|
|
|
2020-12-10 12:26:40 +00:00
|
|
|
type streamWriter struct {
|
|
|
|
stream objectSvc.SearchStream
|
2020-09-22 06:51:47 +00:00
|
|
|
}
|
|
|
|
|
2020-12-10 12:26:40 +00:00
|
|
|
func (s *streamWriter) WriteIDs(ids []*objectSDK.ID) error {
|
|
|
|
r := new(object.SearchResponse)
|
|
|
|
|
|
|
|
body := new(object.SearchResponseBody)
|
|
|
|
r.SetBody(body)
|
2020-09-22 06:51:47 +00:00
|
|
|
|
2020-12-10 12:26:40 +00:00
|
|
|
idsV2 := make([]*refs.ObjectID, len(ids))
|
|
|
|
|
|
|
|
for i := range ids {
|
|
|
|
idsV2[i] = ids[i].ToV2()
|
2020-09-22 06:51:47 +00:00
|
|
|
}
|
|
|
|
|
2020-12-10 12:26:40 +00:00
|
|
|
body.SetIDList(idsV2)
|
|
|
|
|
|
|
|
return s.stream.Send(r)
|
2020-09-22 06:51:47 +00:00
|
|
|
}
|