[#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

@ -21,21 +21,17 @@ type SelectRes struct {
}
// WithContainerID is a Select option to set the container id to search in.
func (p *SelectPrm) WithContainerID(cnr cid.ID) *SelectPrm {
func (p *SelectPrm) WithContainerID(cnr cid.ID) {
if p != nil {
p.cnr = cnr
}
return p
}
// WithFilters is a Select option to set the object filters.
func (p *SelectPrm) WithFilters(fs object.SearchFilters) *SelectPrm {
func (p *SelectPrm) WithFilters(fs object.SearchFilters) {
if p != nil {
p.filters = fs
}
return p
}
// AddressList returns list of addresses of the selected objects.
@ -47,7 +43,7 @@ func (r *SelectRes) AddressList() []oid.Address {
//
// Returns any error encountered that
// did not allow to completely select the objects.
func (s *Shard) Select(prm *SelectPrm) (*SelectRes, error) {
func (s *Shard) Select(prm SelectPrm) (*SelectRes, error) {
addrList, err := meta.Select(s.metaBase, prm.cnr, prm.filters)
if err != nil {
return nil, fmt.Errorf("could not select objects from metabase: %w", err)