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

@ -12,6 +12,8 @@ type UpdateStateArgs struct {
key []byte // peer public key
state int64 // new peer state
client.InvokePrmOptional
}
// SetPublicKey sets peer public key
@ -32,9 +34,9 @@ func (c *Client) UpdateState(args UpdateStateArgs) error {
prm.SetMethod(c.updateStateMethod)
prm.SetArgs(args.state, args.key)
prm.InvokePrmOptional = args.InvokePrmOptional
err := c.client.Invoke(prm)
if err != nil {
return fmt.Errorf("could not invoke method (%s): %w", c.updateStateMethod, err)
}