[#1418] shard: Do not use pointers as parameters

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-05-20 21:08:59 +03:00 committed by fyrchik
parent e265ce2d52
commit 6e752f36dc
39 changed files with 205 additions and 161 deletions

View file

@ -23,23 +23,19 @@ type HeadRes struct {
// WithAddress is a Head option to set the address of the requested object.
//
// Option is required.
func (p *HeadPrm) WithAddress(addr oid.Address) *HeadPrm {
func (p *HeadPrm) WithAddress(addr oid.Address) {
if p != nil {
p.addr = addr
}
return p
}
// WithRaw is a Head option to set raw flag value. If flag is unset, then Head
// returns header of virtual object, otherwise it returns SplitInfo of virtual
// object.
func (p *HeadPrm) WithRaw(raw bool) *HeadPrm {
func (p *HeadPrm) WithRaw(raw bool) {
if p != nil {
p.raw = raw
}
return p
}
// Object returns the requested object header.
@ -53,7 +49,7 @@ func (r *HeadRes) Object() *objectSDK.Object {
//
// Returns an error of type apistatus.ObjectNotFound if object is missing in Shard.
// Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard.
func (s *Shard) Head(prm *HeadPrm) (*HeadRes, error) {
func (s *Shard) Head(prm HeadPrm) (*HeadRes, error) {
// object can be saved in write-cache (if enabled) or in metabase
if s.hasWriteCache() {