state

package
v0.0.0-...-97303f7 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State uint32

State is a peer's state.

State's methods are thread safe. Get the State's value using the Get method if you're accessing it concurrently. Otherwise, you may access it directly.

const (
	// Uninitialized is the initial state.
	Uninitialized State = iota
	// AcceptingInit is the state where the peer is accepting an init message.
	AcceptingInit
	// JoiningCluster is the state where the peer is about to join the cluster.
	JoiningCluster
	// Initialized is the state where the peer is initializing.
	Initialized
	// Failed is the state where the peer has failed.
	Failed
)

func (*State) Advance

func (s *State) Advance(newState State)

Advance advances the state.

func (*State) Get

func (s *State) Get() State

Get gets the state in a thread-safe manner.

func (*State) Require

func (s *State) Require(states ...State) error

Require checks if the state is one of the desired ones and returns an error otherwise.

func (State) String

func (i State) String() string

Jump to

Keyboard shortcuts

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