2020-09-22 06:51:47 +00:00
|
|
|
package searchsvc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"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"
|
2022-05-31 17:00:41 +00:00
|
|
|
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
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
|
|
|
}
|
|
|
|
|
2022-05-31 17:00:41 +00:00
|
|
|
func (s *streamWriter) WriteIDs(ids []oid.ID) error {
|
2020-12-10 12:26:40 +00:00
|
|
|
r := new(object.SearchResponse)
|
|
|
|
|
|
|
|
body := new(object.SearchResponseBody)
|
|
|
|
r.SetBody(body)
|
2020-09-22 06:51:47 +00:00
|
|
|
|
2022-03-15 12:11:35 +00:00
|
|
|
idsV2 := make([]refs.ObjectID, len(ids))
|
2020-12-10 12:26:40 +00:00
|
|
|
|
|
|
|
for i := range ids {
|
2022-05-12 16:37:46 +00:00
|
|
|
ids[i].WriteToV2(&idsV2[i])
|
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
|
|
|
}
|