From 5f57db6bf88320f9fda67d257288640f7938eb48 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 20 May 2022 21:08:59 +0300 Subject: [PATCH] [#1418] shard: Do not use pointers as parameters Signed-off-by: Pavel Karpy --- pkg/local_object_storage/engine/exists.go | 2 +- pkg/local_object_storage/shard/container.go | 2 +- pkg/local_object_storage/shard/dump.go | 2 +- pkg/local_object_storage/shard/exists.go | 2 +- pkg/local_object_storage/shard/inhume.go | 2 +- pkg/local_object_storage/shard/range.go | 4 ++-- pkg/local_object_storage/shard/restore.go | 4 ++-- pkg/local_object_storage/shard/select.go | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/local_object_storage/engine/exists.go b/pkg/local_object_storage/engine/exists.go index 537524ef..3127bf68 100644 --- a/pkg/local_object_storage/engine/exists.go +++ b/pkg/local_object_storage/engine/exists.go @@ -24,7 +24,7 @@ func (e *StorageEngine) exists(addr oid.Address) (bool, error) { e.reportShardError(sh, "could not check existence of object in shard", err) } - if res != nil && !exists { + if !exists { exists = res.Exists() } diff --git a/pkg/local_object_storage/shard/container.go b/pkg/local_object_storage/shard/container.go index 27e4ea41..fc35a0a6 100644 --- a/pkg/local_object_storage/shard/container.go +++ b/pkg/local_object_storage/shard/container.go @@ -20,7 +20,7 @@ func (p *ContainerSizePrm) WithContainerID(cnr cid.ID) { } } -func (r *ContainerSizeRes) Size() uint64 { +func (r ContainerSizeRes) Size() uint64 { return r.size } diff --git a/pkg/local_object_storage/shard/dump.go b/pkg/local_object_storage/shard/dump.go index b27f47c1..170754c5 100644 --- a/pkg/local_object_storage/shard/dump.go +++ b/pkg/local_object_storage/shard/dump.go @@ -42,7 +42,7 @@ type DumpRes struct { } // Count return amount of object written. -func (r *DumpRes) Count() int { +func (r DumpRes) Count() int { return r.count } diff --git a/pkg/local_object_storage/shard/exists.go b/pkg/local_object_storage/shard/exists.go index 3ad35b9f..4eef6471 100644 --- a/pkg/local_object_storage/shard/exists.go +++ b/pkg/local_object_storage/shard/exists.go @@ -27,7 +27,7 @@ func (p *ExistsPrm) WithAddress(addr oid.Address) *ExistsPrm { } // Exists returns the fact that the object is in the shard. -func (p *ExistsRes) Exists() bool { +func (p ExistsRes) Exists() bool { return p.ex } diff --git a/pkg/local_object_storage/shard/inhume.go b/pkg/local_object_storage/shard/inhume.go index 5063d2a3..9b7c25c8 100644 --- a/pkg/local_object_storage/shard/inhume.go +++ b/pkg/local_object_storage/shard/inhume.go @@ -75,5 +75,5 @@ func (s *Shard) Inhume(prm InhumePrm) (*InhumeRes, error) { return nil, fmt.Errorf("metabase inhume: %w", err) } - return new(InhumeRes), nil + return nil, nil } diff --git a/pkg/local_object_storage/shard/range.go b/pkg/local_object_storage/shard/range.go index 7c804f32..dac65a20 100644 --- a/pkg/local_object_storage/shard/range.go +++ b/pkg/local_object_storage/shard/range.go @@ -49,12 +49,12 @@ func (p *RngPrm) WithIgnoreMeta(ignore bool) { // Object returns the requested object part. // // Instance payload contains the requested range of the original object. -func (r *RngRes) Object() *object.Object { +func (r RngRes) Object() *object.Object { return r.obj } // HasMeta returns true if info about the object was found in the metabase. -func (r *RngRes) HasMeta() bool { +func (r RngRes) HasMeta() bool { return r.hasMeta } diff --git a/pkg/local_object_storage/shard/restore.go b/pkg/local_object_storage/shard/restore.go index d714e1b4..62ba885f 100644 --- a/pkg/local_object_storage/shard/restore.go +++ b/pkg/local_object_storage/shard/restore.go @@ -44,12 +44,12 @@ type RestoreRes struct { } // Count return amount of object written. -func (r *RestoreRes) Count() int { +func (r RestoreRes) Count() int { return r.count } // FailCount return amount of object skipped. -func (r *RestoreRes) FailCount() int { +func (r RestoreRes) FailCount() int { return r.failed } diff --git a/pkg/local_object_storage/shard/select.go b/pkg/local_object_storage/shard/select.go index 60dc48be..b4800e81 100644 --- a/pkg/local_object_storage/shard/select.go +++ b/pkg/local_object_storage/shard/select.go @@ -35,7 +35,7 @@ func (p *SelectPrm) WithFilters(fs object.SearchFilters) { } // AddressList returns list of addresses of the selected objects. -func (r *SelectRes) AddressList() []oid.Address { +func (r SelectRes) AddressList() []oid.Address { return r.addrList }