netmap

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilClient = errors.New("netmap contract client is nil")

ErrNilClient is returned by functions that expect a non-nil Client pointer, but received nil.

Functions

This section is empty.

Types

type AddPeerArgs

type AddPeerArgs struct {
	// contains filtered or unexported fields
}

AddPeerArgs groups the arguments of add peer invocation call.

func (*AddPeerArgs) SetInfo

func (a *AddPeerArgs) SetInfo(v PeerInfo)

SetInfo sets the peer information.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a wrapper over StaticClient which makes calls with the names and arguments of the NeoFS Netmap contract.

Working client must be created via constructor New. Using the Client that has been created with new(Client) expression (or just declaring a Client variable) is unsafe and can lead to panic.

func New

func New(c *client.StaticClient, opts ...Option) (*Client, error)

New creates, initializes and returns the Client instance.

If StaticClient is nil, client.ErrNilStaticClient is returned.

Other values are set according to provided options, or by default:

  • add peer method name: AddPeer;
  • new epoch method name: NewEpoch;
  • get network map method name: Netmap;
  • update state method name: UpdateState;
  • inner ring list method name: InnerRingList.

If desired option satisfies the default value, it can be omitted. If multiple options of the same config value are supplied, the option with the highest index in the arguments will be used.

func (*Client) AddPeer

func (c *Client) AddPeer(args AddPeerArgs) error

AddPeer invokes the call of add peer method of NeoFS Netmap contract.

func (*Client) InnerRingList

func (c *Client) InnerRingList(args InnerRingListArgs) (*InnerRingListValues, error)

InnerRingList performs the test invoke of inner ring list method of NeoFS Netmap contract.

func (*Client) NetMap

func (c *Client) NetMap(args GetNetMapArgs) (*GetNetMapValues, error)

NetMap performs the test invoke of get network map method of NeoFS Netmap contract.

func (*Client) NewEpoch

func (c *Client) NewEpoch(args NewEpochArgs) error

NewEpoch invokes the call of new epoch method of NeoFS Netmap contract.

func (*Client) UpdateState

func (c *Client) UpdateState(args UpdateStateArgs) error

UpdateState invokes the call of update state method of NeoFS Netmap contract.

type GetNetMapArgs

type GetNetMapArgs struct {
}

GetNetMapArgs groups the arguments of get network map test invoke call.

type GetNetMapValues

type GetNetMapValues struct {
	// contains filtered or unexported fields
}

GetNetMapValues groups the stack parameters returned by get network map test invoke.

func (GetNetMapValues) Peers

func (g GetNetMapValues) Peers() []PeerInfo

Peers return the list of peers from network map in a binary format.

type InnerRingListArgs

type InnerRingListArgs struct {
}

InnerRingListArgs groups the arguments of inner ring list test invoke call.

type InnerRingListValues

type InnerRingListValues struct {
	// contains filtered or unexported fields
}

InnerRingListValues groups the stack parameters returned by inner ring list test invoke.

func (InnerRingListValues) KeyList

func (g InnerRingListValues) KeyList() [][]byte

KeyList return the list of IR node keys in a binary format.

type NewEpochArgs

type NewEpochArgs struct {
	// contains filtered or unexported fields
}

NewEpochArgs groups the arguments of new epoch invocation call.

func (*NewEpochArgs) SetEpochNumber

func (a *NewEpochArgs) SetEpochNumber(v int64)

SetEpochNumber sets the new epoch number.

type Option

type Option func(*cfg)

Option is a client configuration change function.

func WithAddPeerMethod

func WithAddPeerMethod(n string) Option

WithAddPeerMethod returns a client constructor option that specifies the method name of adding peer operation.

Ignores empty value.

If option not provided, "AddPeer" is used.

func WithInnerRingListMethod

func WithInnerRingListMethod(n string) Option

WithInnerRingListMethod returns a client constructor option that specifies the method name of inner ring listing operation.

Ignores empty value.

If option not provided, "InnerRingList" is used.

func WithNetMapMethod

func WithNetMapMethod(n string) Option

WithNetMapMethod returns a client constructor option that specifies the method name of network map receiving operation.

Ignores empty value.

If option not provided, "Netmap" is used.

func WithNewEpochMethod

func WithNewEpochMethod(n string) Option

WithNewEpochMethod returns a client constructor option that specifies the method name of new epoch operation.

Ignores empty value.

If option not provided, "NewEpoch" is used.

func WithUpdateStateMethod

func WithUpdateStateMethod(n string) Option

WithUpdateStateMethod returns a client constructor option that specifies the method name of peer state updating operation.

Ignores empty value.

If option not provided, "UpdateState" is used.

type PeerInfo

type PeerInfo struct {
	// contains filtered or unexported fields
}

PeerInfo groups the parameters of new NeoFS peer.

func (PeerInfo) Address

func (a PeerInfo) Address() []byte

Address returns the peer network address in a binary format.

Address format is dictated by application architecture.

func (PeerInfo) Options

func (a PeerInfo) Options() [][]byte

Options returns the peer options in a binary format.

Option format is dictated by application architecture.

func (PeerInfo) PublicKey

func (a PeerInfo) PublicKey() []byte

PublicKey returns the peer public key in a binary format.

Key format is dictated by application architecture.

func (*PeerInfo) SetAddress

func (a *PeerInfo) SetAddress(v []byte)

SetAddress sets the peer network address in a binary format.

Address format is dictated by application architecture.

func (*PeerInfo) SetOptions

func (a *PeerInfo) SetOptions(v [][]byte)

SetOptions sets the peer options in a binary format.

Option format is dictated by application architecture.

func (*PeerInfo) SetPublicKey

func (a *PeerInfo) SetPublicKey(v []byte)

SetPublicKey sets the peer public key in a binary format.

Key format is dictated by application architecture.

type UpdateStateArgs

type UpdateStateArgs struct {
	// contains filtered or unexported fields
}

UpdateStateArgs groups the arguments of update state invocation call.

func (*UpdateStateArgs) SetPublicKey

func (u *UpdateStateArgs) SetPublicKey(v []byte)

SetPublicKey sets peer public key in a binary format.

func (*UpdateStateArgs) SetState

func (u *UpdateStateArgs) SetState(v int64)

SetState sets the new peer state.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL