[#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:
parent
3114be39d0
commit
c25f5a86ae
11 changed files with 224 additions and 90 deletions
|
@ -10,6 +10,8 @@ import (
|
|||
// of add peer invocation call.
|
||||
type AddPeerArgs struct {
|
||||
info []byte
|
||||
|
||||
client.InvokePrmOptional
|
||||
}
|
||||
|
||||
// SetInfo sets the peer information.
|
||||
|
@ -24,6 +26,7 @@ func (c *Client) AddPeer(args AddPeerArgs) error {
|
|||
|
||||
prm.SetMethod(c.addPeerMethod)
|
||||
prm.SetArgs(args.info)
|
||||
prm.InvokePrmOptional = args.InvokePrmOptional
|
||||
|
||||
if err := c.client.Invoke(prm); err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", c.addPeerMethod, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue