2020-09-25 13:04:55 +00:00
|
|
|
package rangesvc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
|
|
|
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
|
|
|
rangesvc "github.com/nspcc-dev/neofs-node/pkg/services/object/range"
|
2020-09-29 15:05:22 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
|
2020-09-25 13:04:55 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func toPrm(req *objectV2.GetRangeRequest) *rangesvc.Prm {
|
|
|
|
body := req.GetBody()
|
|
|
|
|
|
|
|
return new(rangesvc.Prm).
|
|
|
|
WithAddress(
|
|
|
|
object.NewAddressFromV2(body.GetAddress()),
|
|
|
|
).
|
|
|
|
WithRange(object.NewRangeFromV2(body.GetRange())).
|
2020-09-29 15:05:22 +00:00
|
|
|
WithCommonPrm(util.CommonPrmFromV2(req))
|
2020-09-25 13:04:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func fromResponse(stream rangesvc.Streamer) objectV2.GetRangeObjectStreamer {
|
|
|
|
return &streamer{
|
|
|
|
stream: stream,
|
|
|
|
body: new(objectV2.GetRangeResponseBody),
|
|
|
|
}
|
|
|
|
}
|