frostfs-node/pkg/services/object/search/v2/streamer.go
Pavel Karpy 923f84722a Move to frostfs-node
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
2022-12-28 15:04:29 +03:00

29 lines
616 B
Go

package searchsvc
import (
"github.com/TrueCloudLab/frostfs-api-go/v2/object"
"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
objectSvc "github.com/TrueCloudLab/frostfs-node/pkg/services/object"
oid "github.com/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)
}