forked from TrueCloudLab/frostfs-node
1667ec9e6d
`object.Address` has been moved to `object/address` `object.ID` has been moved to `object/id` Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
34 lines
900 B
Go
34 lines
900 B
Go
package deletesvc
|
|
|
|
import (
|
|
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
|
deletesvc "github.com/nspcc-dev/neofs-node/pkg/services/object/delete"
|
|
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
|
|
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
|
|
)
|
|
|
|
type tombstoneBodyWriter struct {
|
|
body *objectV2.DeleteResponseBody
|
|
}
|
|
|
|
func (s *Service) toPrm(req *objectV2.DeleteRequest, respBody *objectV2.DeleteResponseBody) (*deletesvc.Prm, error) {
|
|
commonPrm, err := util.CommonPrmFromV2(req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
p := new(deletesvc.Prm)
|
|
p.SetCommonParameters(commonPrm)
|
|
|
|
body := req.GetBody()
|
|
p.WithAddress(addressSDK.NewAddressFromV2(body.GetAddress()))
|
|
p.WithTombstoneAddressTarget(&tombstoneBodyWriter{
|
|
body: respBody,
|
|
})
|
|
|
|
return p, nil
|
|
}
|
|
|
|
func (w *tombstoneBodyWriter) SetAddress(addr *addressSDK.Address) {
|
|
w.body.SetTombstone(addr.ToV2())
|
|
}
|