Airat Arifullin
9b13a18aac
* Update version within go.mod; * Fix deprecated frostfs-api-go/v2 package and use frostfs-sdk-go/api instead. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
29 lines
642 B
Go
29 lines
642 B
Go
package searchsvc
|
|
|
|
import (
|
|
objectSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs"
|
|
oid "git.frostfs.info/TrueCloudLab/frostfs-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)
|
|
}
|