peers

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingQID       = errors.New("invalid quorum configuration: quorum id is required")
	ErrNoPeers          = errors.New("invalid quorum configuration: no peers assigned to quorum")
	ErrUniquePID        = errors.New("invalid quorum configuration: peer ids must be unique")
	ErrMissingPID       = errors.New("invalid peer configuration: peer id is required")
	ErrPeerMissingField = errors.New("invalid peer configuration: name, bind_addr, and endpoint are required")
)

Validation Errors

Functions

This section is empty.

Types

type Peer

type Peer struct {
	PID      uint32 `json:"peer_id" yaml:"peer_id"`     // the unique ID of the peer in the system
	Name     string `json:"name" yaml:"name"`           // a human readable name for the peer (e.g. hostname)
	BindAddr string `json:"bind_addr" yaml:"bind_addr"` // the address to bind the peer on to listen for requests
	Endpoint string `json:"endpoint" yaml:"endpoint"`   // the domain or ip address and port to connect to the peer on
}

Peer is a configuration of a peer and contains all connection and helper information.

func (*Peer) Validate

func (p *Peer) Validate() error

type Quorum

type Quorum struct {
	QID             uint32  `json:"quorum_id" yaml:"quorum_id"`                                  // the unique ID of the quorum of peers
	BootstrapLeader uint32  `json:"boostrap_leader,omitempty" yaml:"bootstrap_leader,omitempty"` // the PID of the leader to bootstrap at term 0
	Peers           []*Peer `json:"peers" yaml:"peers"`                                          // the peers that are in the quorum
}

Quorum represents the configuration of a quorum on disk.

func Load

func Load(path string) (quorum *Quorum, err error)

Load the quorum configuration from disk.

func (*Quorum) Contains

func (q *Quorum) Contains(pidorname interface{}) bool

Contains checks if the quorum contains the peer specified by PID or name.

func (*Quorum) Dump

func (q *Quorum) Dump(path string) (err error)

Dump the quorum configuration to disk.

func (*Quorum) Validate

func (q *Quorum) Validate() (err error)

Jump to

Keyboard shortcuts

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