forked from TrueCloudLab/frostfs-node
3c5b62d839
We don't use custom names and the only place where custom method option is used it provides the default name and can be omitted. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
35 lines
717 B
Go
35 lines
717 B
Go
package netmap
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
|
)
|
|
|
|
// AddPeerArgs groups the arguments
|
|
// of add peer invocation call.
|
|
type AddPeerArgs struct {
|
|
info []byte
|
|
|
|
client.InvokePrmOptional
|
|
}
|
|
|
|
// SetInfo sets the peer information.
|
|
func (a *AddPeerArgs) SetInfo(v []byte) {
|
|
a.info = v
|
|
}
|
|
|
|
// AddPeer invokes the call of add peer method
|
|
// of NeoFS Netmap contract.
|
|
func (c *Client) AddPeer(args AddPeerArgs) error {
|
|
prm := client.InvokePrm{}
|
|
|
|
prm.SetMethod(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", addPeerMethod, err)
|
|
}
|
|
return nil
|
|
}
|