2020-09-22 06:51:47 +00:00
|
|
|
package searchsvc
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
|
|
|
objectSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object"
|
|
|
|
oid "git.frostfs.info/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
|
|
|
}
|