netmap

package
v0.46.14 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxObjectSizeConfig             = "MaxObjectSize"
	MaxECParityCountConfig          = "MaxECParityCount"
	MaxECDataCountConfig            = "MaxECDataCount"
	EpochDurationConfig             = "EpochDuration"
	ContainerFeeConfig              = "ContainerFee"
	ContainerAliasFeeConfig         = "ContainerAliasFee"
	IrCandidateFeeConfig            = "InnerRingCandidateFee"
	WithdrawFeeConfig               = "WithdrawFee"
	HomomorphicHashingDisabledKey   = "HomomorphicHashingDisabled"
	MaintenanceModeAllowedConfig    = "MaintenanceModeAllowed"
	NetmapNodesAssumedTrustedConfig = "NetmapNodesAssumedTrusted"
)

Variables

This section is empty.

Functions

func DecodeNetMap

func DecodeNetMap(resStack []stackitem.Item) (*netmap.NetMap, error)

Types

type AddPeerPrm

type AddPeerPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

AddPeerPrm groups parameters of AddPeer operation.

func (*AddPeerPrm) SetNodeInfo

func (a *AddPeerPrm) SetNodeInfo(nodeInfo netmap.NodeInfo)

SetNodeInfo sets new peer NodeInfo.

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 FrostFS 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 NewFromMorph

func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*Client, error)

NewFromMorph returns the wrapper instance from the raw morph client.

func (*Client) AddPeer

func (c *Client) AddPeer(ctx context.Context, p AddPeerPrm) error

AddPeer registers peer in FrostFS network through Netmap contract call.

func (*Client) ContainerAliasFee

func (c *Client) ContainerAliasFee(ctx context.Context) (uint64, error)

ContainerAliasFee returns additional fee paid by container owner to each alphabet node for container nice name registration.

func (*Client) ContainerFee

func (c *Client) ContainerFee(ctx context.Context) (uint64, error)

ContainerFee returns fee paid by container owner to each alphabet node for container registration.

func (Client) ContractAddress

func (c Client) ContractAddress() util.Uint160

ContractAddress returns the address of the associated contract.

func (*Client) Epoch

func (c *Client) Epoch(ctx context.Context) (uint64, error)

Epoch receives number of current FrostFS epoch through the Netmap contract call.

func (*Client) EpochDuration

func (c *Client) EpochDuration(ctx context.Context) (uint64, error)

EpochDuration returns number of sidechain blocks per one FrostFS epoch.

func (*Client) ForceRemovePeer added in v0.37.0

func (c *Client) ForceRemovePeer(ctx context.Context, nodeInfo netmap.NodeInfo, vub uint32) (uint32, error)

ForceRemovePeer marks the given peer as offline via a notary control transaction. If vub > 0, vub will be used as valid until block value.

func (*Client) GetCandidates

func (c *Client) GetCandidates(ctx context.Context) ([]netmap.NodeInfo, error)

GetCandidates calls "netmapCandidates" method and decodes []netmap.NodeInfo from the response.

func (*Client) GetInnerRingList

func (c *Client) GetInnerRingList(ctx context.Context) (keys.PublicKeys, error)

GetInnerRingList return current IR list.

func (*Client) GetNetMap

func (c *Client) GetNetMap(ctx context.Context, diff uint64) (*netmap.NetMap, error)

GetNetMap calls "snapshot" method and decodes netmap.NetMap from the response.

func (*Client) GetNetMapByEpoch

func (c *Client) GetNetMapByEpoch(ctx context.Context, epoch uint64) (*netmap.NetMap, error)

GetNetMapByEpoch calls "snapshotByEpoch" method with the given epoch and decodes netmap.NetMap from the response.

func (*Client) HomomorphicHashDisabled

func (c *Client) HomomorphicHashDisabled(ctx context.Context) (bool, error)

HomomorphicHashDisabled returns global configuration value of homomorphic hashing settings.

Returns (false, nil) if config key is not found in the contract.

func (*Client) InnerRingCandidateFee

func (c *Client) InnerRingCandidateFee(ctx context.Context) (uint64, error)

InnerRingCandidateFee returns global configuration value of fee paid by node to be in inner ring candidates list.

func (*Client) LastEpochBlock

func (c *Client) LastEpochBlock(ctx context.Context) (uint32, error)

LastEpochBlock receives block number of current FrostFS epoch through the Netmap contract call.

func (*Client) MaintenanceModeAllowed

func (c *Client) MaintenanceModeAllowed(ctx context.Context) (bool, error)

MaintenanceModeAllowed reads admission of "maintenance" state from the FrostFS network configuration stored in the Sidechain. The admission means that storage nodes are allowed to switch their state to "maintenance".

By default, maintenance state is disallowed.

func (*Client) MaxObjectSize

func (c *Client) MaxObjectSize(ctx context.Context) (uint64, error)

MaxObjectSize receives max object size configuration value through the Netmap contract call.

func (Client) Morph

func (c Client) Morph() *client.Client

Morph returns raw morph client.

func (*Client) NetMap

func (c *Client) NetMap(ctx context.Context) (*netmap.NetMap, error)

NetMap calls "netmap" method and decode netmap.NetMap from the response.

func (*Client) NetmapNodesAssumedTrusted added in v0.45.0

func (c *Client) NetmapNodesAssumedTrusted(ctx context.Context) (bool, error)

NetmapNodesAssumedTrusted returns global configuration value of assuming netmap nodes are trusted.

Returns (false, nil) if config key is not found in the contract.

func (*Client) NewEpoch

func (c *Client) NewEpoch(ctx context.Context, epoch uint64) error

NewEpoch updates FrostFS epoch number through Netmap contract call.

func (*Client) NewEpochControl added in v0.38.0

func (c *Client) NewEpochControl(ctx context.Context, epoch uint64, vub uint32) (uint32, error)

NewEpochControl updates FrostFS epoch number through control notary transaction internally to ensure all nodes produce the same transaction with high probability. If vub > 0, vub will be used as valid until block value.

func (*Client) ReadNetworkConfiguration

func (c *Client) ReadNetworkConfiguration(ctx context.Context) (NetworkConfiguration, error)

ReadNetworkConfiguration reads NetworkConfiguration from the FrostFS Sidechain.

func (*Client) SetConfig

func (c *Client) SetConfig(ctx context.Context, p SetConfigPrm) error

SetConfig sets config field.

func (*Client) UpdateInnerRing

func (c *Client) UpdateInnerRing(ctx context.Context, p UpdateIRPrm) error

UpdateInnerRing updates inner ring keys.

func (*Client) UpdatePeerState

func (c *Client) UpdatePeerState(ctx context.Context, p UpdatePeerPrm) (client.InvokeRes, error)

UpdatePeerState changes peer status through Netmap contract call.

func (*Client) WithdrawFee

func (c *Client) WithdrawFee(ctx context.Context) (uint64, error)

WithdrawFee returns global configuration value of fee paid by user to withdraw assets from FrostFS contract.

type NetworkConfiguration

type NetworkConfiguration struct {
	MaxObjectSize uint64

	EpochDuration uint64

	ContainerFee uint64

	ContainerAliasFee uint64

	IRCandidateFee uint64

	WithdrawalFee uint64

	HomomorphicHashingDisabled bool

	MaintenanceModeAllowed bool

	NetmapNodesAssumedTrusted bool

	Raw []RawNetworkParameter
}

NetworkConfiguration represents FrostFS network configuration stored in the FrostFS Sidechain.

type NodeInfo

type NodeInfo = netmap.NodeInfo

type Option

type Option func(*opts)

Option allows to set an optional parameter of Wrapper.

func AsAlphabet

func AsAlphabet() Option

AsAlphabet returns option to sign main TX of notary requests with client's private key.

Considered to be used by IR nodes only.

type RawNetworkParameter

type RawNetworkParameter struct {
	// Name of the parameter.
	Name string

	// Raw parameter value.
	Value []byte
}

RawNetworkParameter is a FrostFS network parameter which is transmitted but not interpreted by the FrostFS API protocol.

type SetConfigPrm

type SetConfigPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

SetConfigPrm groups parameters of SetConfig operation.

func (*SetConfigPrm) SetID

func (s *SetConfigPrm) SetID(id []byte)

SetID sets ID of the config value.

func (*SetConfigPrm) SetKey

func (s *SetConfigPrm) SetKey(key []byte)

SetKey sets key of the config value.

func (*SetConfigPrm) SetValue

func (s *SetConfigPrm) SetValue(value any)

SetValue sets value of the config value.

type UpdateIRPrm

type UpdateIRPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

UpdateIRPrm groups parameters of UpdateInnerRing invocation.

func (*UpdateIRPrm) SetKeys

func (u *UpdateIRPrm) SetKeys(keys keys.PublicKeys)

SetKeys sets new inner ring keys.

type UpdatePeerPrm

type UpdatePeerPrm struct {
	client.InvokePrmOptional
	// contains filtered or unexported fields
}

UpdatePeerPrm groups parameters of UpdatePeerState operation.

func (*UpdatePeerPrm) SetKey

func (u *UpdatePeerPrm) SetKey(key []byte)

SetKey sets public key.

func (*UpdatePeerPrm) SetMaintenance

func (u *UpdatePeerPrm) SetMaintenance()

SetMaintenance marks node to be switched into "maintenance" state.

Zero UpdatePeerPrm marks node as "offline".

func (*UpdatePeerPrm) SetOnline

func (u *UpdatePeerPrm) SetOnline()

SetOnline marks node to be switched into "online" state.

Zero UpdatePeerPrm marks node as "offline".

Jump to

Keyboard shortcuts

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