1c30414a6c
Core changes: * avoid package-colliding variable naming * avoid using pointers to IDs where unnecessary * avoid using `idSDK` import alias pattern * use `EncodeToString` for protocol string calculation and `String` for printing Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
29 lines
596 B
Go
29 lines
596 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"
|
|
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
|
)
|
|
|
|
type streamWriter struct {
|
|
stream objectSvc.SearchStream
|
|
}
|
|
|
|
func (s *streamWriter) WriteIDs(ids []oid.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)
|
|
}
|