peer

package
v0.0.0-...-10866ab Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package peer describes a ckit peer.

Index

Constants

This section is empty.

Variables

AllStates holds a list of all valid states.

Functions

This section is empty.

Types

type Peer

type Peer struct {
	Name  string // Name of the Peer. Unique across the cluster.
	Addr  string // host:port address of the peer.
	Self  bool   // True if Peer is the local Node.
	State State  // State of the peer.
}

Peer is a discovered node within the cluster.

func (Peer) MarshalJSON

func (p Peer) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Peer) String

func (p Peer) String() string

String returns the name of p.

func (*Peer) UnmarshalJSON

func (p *Peer) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type State

type State uint

State is used by Nodes to inform their peers what their role is as part of gossip.

const (
	// StateViewer is the default state. Nodes in the Viewer state have a
	// read-only view of the cluster, and are never considered owners when
	// hashing.
	StateViewer State = iota

	// StateParticipant marks a node as available to receive writes. It will be
	// considered a potential owner while hashing read or write operations.
	StateParticipant

	// StateTerminating is used when a Participant node is shutting down.
	// Terminating nodes are considered potential owners while hashing read
	// operations.
	StateTerminating
)

func (State) String

func (s State) String() string

String returns the string representation of s.

Jump to

Keyboard shortcuts

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