node

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 ErrNilInfo = errors.New("node info is nil")

ErrNilInfo is returned by functions that expect a non-nil Info pointer, but received nil.

Functions

func CopyOptions

func CopyOptions(i Info) []string

CopyOptions returns the copy of node options list.

Changing the result is safe and does not affect the node info.

func CopyPublicKey

func CopyPublicKey(i Info) []byte

CopyPublicKey returns the copy of node public key.

Changing the result is safe and does not affect the node info.

func SetOptionsCopy

func SetOptionsCopy(i *Info, opts []string)

SetOptionsCopy copies option list and sets the copy as node options list.

Subsequent changing the source slice is safe and does not affect node info.

SetOptionsCopy does nothing if Info is nil.

func SetPublicKeyCopy

func SetPublicKeyCopy(i *Info, key []byte) error

SetPublicKeyCopy copies public key and sets the copy as node public key.

Subsequent changing the source slice is safe and does not affect node info.

Returns ErrNilInfo on nil node info.

func StatusToUint64

func StatusToUint64(s Status) uint64

StatusToUint64 converts Status value to builtin uint64.

Try to avoid direct cast for better portability.

Types

type Info

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

Info represents the information about NeoFS storage node.

func (Info) Address

func (i Info) Address() string

Address returns node network address.

Address format is dictated by application architecture.

func (Info) Capacity

func (i Info) Capacity() uint64

Capacity parses node options and returns the capacity .

func (Info) Options

func (i Info) Options() []string

Options returns node option list.

Changing the result is unsafe and affects the node info. In order to prevent state mutations, use CopyOptions.

Option format is dictated by application architecture.

func (Info) Price

func (i Info) Price() uint64

Price parses node options and returns the price in 1e-8*GAS/Megabyte per month.

User sets the price in GAS/Terabyte per month.

func (Info) PublicKey

func (i Info) PublicKey() []byte

PublicKey returns node public key in a binary format.

Changing the result is unsafe and affects the node info. In order to prevent state mutations, use CopyPublicKey.

Key format is dictated by application architecture.

func (*Info) SetAddress

func (i *Info) SetAddress(v string)

SetAddress sets node network address.

func (*Info) SetOptions

func (i *Info) SetOptions(v []string)

SetOptions sets node option list.

Subsequent changing the source slice is unsafe and affects node info. In order to prevent state mutations, use SetOptionsCopy.

func (*Info) SetPublicKey

func (i *Info) SetPublicKey(v []byte)

SetPublicKey sets node public key in a binary format.

Subsequent changing the source slice is unsafe and affects node info. In order to prevent state mutations, use SetPublicKeyCopy.

func (*Info) SetStatus

func (i *Info) SetStatus(v Status)

SetStatus sets the node status.

func (Info) Status

func (i Info) Status() Status

Status returns the node status.

type Status

type Status uint64

Status represents a node status bits.

func StatusFromUint64

func StatusFromUint64(v uint64) Status

StatusFromUint64 converts builtin uint64 value to Status.

Try to avoid direct cast for better portability.

func (Status) Full

func (n Status) Full() bool

Full returns true if node is in Full status.

Full status marks node has enough space for storing users objects.

func (*Status) ResetFull

func (n *Status) ResetFull()

ResetFull resets Full status of node.

func (*Status) SetFull

func (n *Status) SetFull()

SetFull sets Full status of node.

Jump to

Keyboard shortcuts

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