2020-09-22 06:51:47 +00:00
|
|
|
package searchsvc
|
|
|
|
|
|
|
|
import (
|
2022-12-23 17:35:35 +00:00
|
|
|
"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"
|
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
|
|
|
}
|