[#971] morph/netmap: Add optional parameters

Add optional parameters to the client call
signature. Group parameters of a client call
into struct to improve future codebase
support.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-11-10 13:44:19 +03:00 committed by Alex Vanin
parent 3114be39d0
commit c25f5a86ae
11 changed files with 224 additions and 90 deletions

View file

@ -1,10 +1,32 @@
package wrapper
import "github.com/nspcc-dev/neo-go/pkg/crypto/keys"
import (
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
)
// UpdateIRPrm groups parameters of UpdateInnerRing
// invocation.
type UpdateIRPrm struct {
keys keys.PublicKeys
client.InvokePrmOptional
}
// SetKeys sets new inner ring keys.
func (u *UpdateIRPrm) SetKeys(keys keys.PublicKeys) {
u.keys = keys
}
// UpdateInnerRing updates inner ring keys.
func (w *Wrapper) UpdateInnerRing(keys keys.PublicKeys) error {
return w.client.UpdateInnerRing(keys)
func (w *Wrapper) UpdateInnerRing(prm UpdateIRPrm) error {
args := netmap.UpdateIRPrm{}
args.SetKeys(prm.keys)
args.InvokePrmOptional = prm.InvokePrmOptional
return w.client.UpdateInnerRing(args)
}
// GetInnerRingList return current IR list.