[#230] engine: Rename WithAddress to WithAddresses for delete operations

Delete works with multiple addresses at once so it is convenient to
show it in parameter setter function.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-03 12:53:08 +03:00
parent 7c97bd1360
commit a488d202e1
4 changed files with 8 additions and 8 deletions

View file

@ -185,7 +185,7 @@ type localObjectInhumer struct {
func (r *localObjectRemover) Delete(addr ...*objectSDK.Address) error {
_, err := r.storage.Delete(new(engine.DeletePrm).
WithAddress(addr...),
WithAddresses(addr...),
)
return err

View file

@ -14,10 +14,10 @@ type DeletePrm struct {
// DeleteRes groups resulting values of Delete operation.
type DeleteRes struct{}
// WithAddress is a Delete option to set the addresses of the objects to delete.
// WithAddresses is a Delete option to set the addresses of the objects to delete.
//
// Option is required.
func (p *DeletePrm) WithAddress(addr ...*objectSDK.Address) *DeletePrm {
func (p *DeletePrm) WithAddresses(addr ...*objectSDK.Address) *DeletePrm {
if p != nil {
p.addr = append(p.addr, addr...)
}
@ -28,7 +28,7 @@ func (p *DeletePrm) WithAddress(addr ...*objectSDK.Address) *DeletePrm {
// Delete removes objects from the shards.
func (e *StorageEngine) Delete(prm *DeletePrm) (*DeleteRes, error) {
shPrm := new(shard.DeletePrm).
WithAddress(prm.addr...)
WithAddresses(prm.addr...)
e.iterateOverUnsortedShards(func(sh *shard.Shard) (stop bool) {
_, err := sh.Delete(shPrm)

View file

@ -15,10 +15,10 @@ type DeletePrm struct {
// DeleteRes groups resulting values of Delete operation.
type DeleteRes struct{}
// WithAddress is a Delete option to set the addresses of the objects to delete.
// WithAddresses is a Delete option to set the addresses of the objects to delete.
//
// Option is required.
func (p *DeletePrm) WithAddress(addr ...*objectSDK.Address) *DeletePrm {
func (p *DeletePrm) WithAddresses(addr ...*objectSDK.Address) *DeletePrm {
if p != nil {
p.addr = append(p.addr, addr...)
}

View file

@ -42,7 +42,7 @@ func testShardDelete(t *testing.T, sh *shard.Shard) {
getPrm.WithAddress(obj.Object().Address())
delPrm := new(shard.DeletePrm)
delPrm.WithAddress(obj.Object().Address())
delPrm.WithAddresses(obj.Object().Address())
_, err := sh.Put(putPrm)
require.NoError(t, err)
@ -65,7 +65,7 @@ func testShardDelete(t *testing.T, sh *shard.Shard) {
getPrm.WithAddress(obj.Object().Address())
delPrm := new(shard.DeletePrm)
delPrm.WithAddress(obj.Object().Address())
delPrm.WithAddresses(obj.Object().Address())
_, err := sh.Put(putPrm)
require.NoError(t, err)