peer

package
v0.0.0-...-ddf849a Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

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) String

func (p Peer) String() string

String returns the name of p.

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