From a488d202e144aa570fb2427ed7dddc21e4da8d8c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 3 Dec 2020 12:53:08 +0300 Subject: [PATCH] [#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 --- cmd/neofs-node/object.go | 2 +- pkg/local_object_storage/engine/delete.go | 6 +++--- pkg/local_object_storage/shard/delete.go | 4 ++-- pkg/local_object_storage/shard/delete_test.go | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 72541c962d..2ce5b101f2 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -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 diff --git a/pkg/local_object_storage/engine/delete.go b/pkg/local_object_storage/engine/delete.go index b3f4b4d8f2..664c324216 100644 --- a/pkg/local_object_storage/engine/delete.go +++ b/pkg/local_object_storage/engine/delete.go @@ -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) diff --git a/pkg/local_object_storage/shard/delete.go b/pkg/local_object_storage/shard/delete.go index 5a685767a6..00a026be8e 100644 --- a/pkg/local_object_storage/shard/delete.go +++ b/pkg/local_object_storage/shard/delete.go @@ -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...) } diff --git a/pkg/local_object_storage/shard/delete_test.go b/pkg/local_object_storage/shard/delete_test.go index 91a36d4e32..cd40b50efd 100644 --- a/pkg/local_object_storage/shard/delete_test.go +++ b/pkg/local_object_storage/shard/delete_test.go @@ -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)