2020-07-24 16:54:03 +03:00
|
|
|
package netmap
|
|
|
|
|
|
|
|
import (
|
2021-05-18 11:12:51 +03:00
|
|
|
"fmt"
|
2020-07-24 16:54:03 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// AddPeerArgs groups the arguments
|
|
|
|
// of add peer invocation call.
|
|
|
|
type AddPeerArgs struct {
|
2020-09-08 12:37:53 +03:00
|
|
|
info []byte
|
2020-07-24 16:54:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetInfo sets the peer information.
|
2020-09-08 12:37:53 +03:00
|
|
|
func (a *AddPeerArgs) SetInfo(v []byte) {
|
2020-07-24 16:54:03 +03:00
|
|
|
a.info = v
|
|
|
|
}
|
|
|
|
|
|
|
|
// AddPeer invokes the call of add peer method
|
|
|
|
// of NeoFS Netmap contract.
|
|
|
|
func (c *Client) AddPeer(args AddPeerArgs) error {
|
2021-05-18 11:12:51 +03:00
|
|
|
if err := c.client.Invoke(c.addPeerMethod, args.info); err != nil {
|
|
|
|
return fmt.Errorf("could not invoke method (%s): %w", c.addPeerMethod, err)
|
|
|
|
}
|
|
|
|
return nil
|
2020-07-24 16:54:03 +03:00
|
|
|
}
|