From 14366bbd89b15f6353b2e452e80ca1295dbcc491 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 23 May 2022 16:12:32 +0300 Subject: [PATCH] [#1418] engine: Do not use pointers as parameters Signed-off-by: Pavel Karpy --- pkg/local_object_storage/engine/container.go | 4 ++-- pkg/local_object_storage/engine/get.go | 2 +- pkg/local_object_storage/engine/head.go | 2 +- pkg/local_object_storage/engine/range.go | 2 +- pkg/local_object_storage/engine/select.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/local_object_storage/engine/container.go b/pkg/local_object_storage/engine/container.go index 5468bad1e..ced3f3cdb 100644 --- a/pkg/local_object_storage/engine/container.go +++ b/pkg/local_object_storage/engine/container.go @@ -70,7 +70,7 @@ func (e *StorageEngine) containerSize(prm ContainerSizePrm) (*ContainerSizeRes, defer elapsed(e.metrics.AddEstimateContainerSizeDuration)() } - var res ContainerSizeRes + res := new(ContainerSizeRes) e.iterateOverUnsortedShards(func(sh hashedShard) (stop bool) { size, err := shard.ContainerSize(sh.Shard, prm.cnr) @@ -86,7 +86,7 @@ func (e *StorageEngine) containerSize(prm ContainerSizePrm) (*ContainerSizeRes, return false }) - return &res, nil + return res, nil } // ListContainers returns a unique container IDs presented in the engine objects. diff --git a/pkg/local_object_storage/engine/get.go b/pkg/local_object_storage/engine/get.go index f4922f8ce..ee722601f 100644 --- a/pkg/local_object_storage/engine/get.go +++ b/pkg/local_object_storage/engine/get.go @@ -31,7 +31,7 @@ func (p *GetPrm) WithAddress(addr oid.Address) { } // Object returns the requested object. -func (r *GetRes) Object() *objectSDK.Object { +func (r GetRes) Object() *objectSDK.Object { return r.obj } diff --git a/pkg/local_object_storage/engine/head.go b/pkg/local_object_storage/engine/head.go index 21e42b7ab..250cd0742 100644 --- a/pkg/local_object_storage/engine/head.go +++ b/pkg/local_object_storage/engine/head.go @@ -42,7 +42,7 @@ func (p *HeadPrm) WithRaw(raw bool) { // Header returns the requested object header. // // Instance has empty payload. -func (r *HeadRes) Header() *objectSDK.Object { +func (r HeadRes) Header() *objectSDK.Object { return r.head } diff --git a/pkg/local_object_storage/engine/range.go b/pkg/local_object_storage/engine/range.go index 23fbc0212..63a52ffbd 100644 --- a/pkg/local_object_storage/engine/range.go +++ b/pkg/local_object_storage/engine/range.go @@ -46,7 +46,7 @@ func (p *RngPrm) WithPayloadRange(rng *objectSDK.Range) { // Object returns the requested object part. // // Instance payload contains the requested range of the original object. -func (r *RngRes) Object() *objectSDK.Object { +func (r RngRes) Object() *objectSDK.Object { return r.obj } diff --git a/pkg/local_object_storage/engine/select.go b/pkg/local_object_storage/engine/select.go index 0ab0a43df..a2879897c 100644 --- a/pkg/local_object_storage/engine/select.go +++ b/pkg/local_object_storage/engine/select.go @@ -33,7 +33,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 }