wrapper

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

ErrNilWrapper is returned by functions that expect a non-nil Wrapper pointer, but received nil.

Functions

This section is empty.

Types

type Client

type Client = netmap.Client

Client represents the Netmap contract client.

It is a type alias of github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap.Client.

type Info

type Info = netmap.Info

Info represents node information.

It is a type alias of github.com/nspcc-dev/neofs-node/pkg/core/netmap.Info.

type NetMap

type NetMap = netmap.NetMap

NetMap represents the NeoFS network map.

It is a type alias of github.com/nspcc-dev/neofs-node/pkg/core/NetMap.

type NodeState

type NodeState int64

NodeState is a type of node states enumeration.

const (

	// StateOffline is an offline node state value.
	StateOffline NodeState
)

type Wrapper

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

Wrapper is a wrapper over netmap contract client which implements:

  • network map storage;
  • tool for peer state updating.

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

func New

func New(c *Client) (*Wrapper, error)

New creates, initializes and returns the Wrapper instance.

If Client is nil, netmap.ErrNilClient is returned.

func (*Wrapper) AddPeer

func (w *Wrapper) AddPeer(nodeInfo netmap.Info) error

AddPeer registers peer in NeoFS network through Netmap contract call.

func (*Wrapper) GetNetMap

func (w *Wrapper) GetNetMap() (*NetMap, error)

GetNetMap receives information list about storage nodes through the Netmap contract call, composes network map from them and returns it.

func (*Wrapper) InnerRingKeys

func (w *Wrapper) InnerRingKeys() ([][]byte, error)

InnerRingKeys receives public key list of inner ring nodes through Netmap contract call and returns it.

func (*Wrapper) NewEpoch

func (w *Wrapper) NewEpoch(e epoch.Epoch) error

NewEpoch updates NeoFS epoch number through Netmap contract call.

func (*Wrapper) UpdatePeerState

func (w *Wrapper) UpdatePeerState(key []byte, state NodeState) error

UpdatePeerState changes peer status through Netmap contract call.

Jump to

Keyboard shortcuts

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