[#957] services/object: Refactor usage of NeoFS API client

The client needs of the Object service are limited and change not often.
Interface changes of the client library should not affect the operation of
various service packages, if they do not change their requirements for
the provided functionality. To localize the use of the base client and
facilitate further support, an auxiliary package is implemented that will
only be used by the Object service.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-11-01 11:35:33 +03:00 committed by LeL
parent bbc2b873ab
commit b3708fc530
15 changed files with 511 additions and 204 deletions

View file

@ -1,18 +1,35 @@
package deletesvc
import (
"github.com/nspcc-dev/neofs-api-go/pkg/client"
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
)
// TombstoneAddressWriter is an interface of tombstone address setter.
type TombstoneAddressWriter interface {
SetAddress(*object.Address)
}
// Prm groups parameters of Delete service call.
type Prm struct {
common *util.CommonPrm
client.DeleteObjectParams
addr *object.Address
tombAddrWriter TombstoneAddressWriter
}
// SetCommonParameters sets common parameters of the operation.
func (p *Prm) SetCommonParameters(common *util.CommonPrm) {
p.common = common
}
// WithAddress sets address of the object to be removed.
func (p *Prm) WithAddress(addr *object.Address) {
p.addr = addr
}
// WithTombstoneAddressTarget sets tombstone address destination.
func (p *Prm) WithTombstoneAddressTarget(w TombstoneAddressWriter) {
p.tombAddrWriter = w
}