membership

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Membership

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

Membership handles all the logic of the Node persistence and also the localVolumes

func New

func New(cfg *config.Config, lv []volume.Local, remote string, logger *slog.Logger) (*Membership, error)

New returns an implementation of the Membership interface

func (*Membership) AllVolumeIDs added in v0.5.0

func (m *Membership) AllVolumeIDs() []string

AllVolumeIDs returns a flat deduplicated slice of all volume IDs known to this node: local volumes plus volumes of all running remote nodes.

func (*Membership) GetNodeState added in v0.3.0

func (m *Membership) GetNodeState(nn string) (*State, error)

GetNodeState returns the volume State

func (*Membership) GetNodeWithVolumeByID

func (m *Membership) GetNodeWithVolumeByID(vid string) (*client.Client, error)

GetNodeWithVolumeByID returns the Node/client.Client that has the gicen vid

func (*Membership) IsRunning added in v0.5.0

func (m *Membership) IsRunning() bool

IsRunning returns true when the node is fully operational. Used as a ready-check function passed to the HTTP transport.

func (*Membership) Leave

func (m *Membership) Leave()

Leave makes the node leave the cluster

func (*Membership) LocalVolumes

func (m *Membership) LocalVolumes() []volume.Local

LocalVolumes returns all the local volumes

func (*Membership) Nodes

func (m *Membership) Nodes() (res []*client.Client)

Nodes return all the nodes of the Cluster

func (*Membership) NodesWithCapacity added in v0.5.0

func (m *Membership) NodesWithCapacity(size int64) (res []*client.Client)

NodesWithCapacity returns all peer nodes that have at least one volume with enough gossip-reported free space to store size bytes.

func (*Membership) NodesWithoutVolumeIDs added in v0.3.0

func (m *Membership) NodesWithoutVolumeIDs(vids []string) []*client.Client

NodesWithoutVolumeIDs returns all running nodes that do not hold any of the given volume IDs, sorted by descending total free space so the best-capacity node is tried first during replication.

func (*Membership) RemovedVolumeIDs

func (m *Membership) RemovedVolumeIDs() []string

RemovedVolumeIDs returns the list of removed VolumeIDs from the cluster. WARNING: Each call to it empties the list so the list of nodes have to be stored/used once called

func (*Membership) SetDraining added in v0.5.0

func (m *Membership) SetDraining(draining bool)

SetDraining satisfies the storing.Membership interface.

func (*Membership) SetStatus added in v0.5.0

func (m *Membership) SetStatus(s Status)

SetStatus sets the lifecycle status of this node and propagates it to peers.

type Metadata added in v0.3.0

type Metadata struct {
	// Port is the port in which the storing.Service is
	// raised, needed to connect to the client
	Port int `json:"port"`

	// Volumes list of all VolumeIDs of the Node
	Volumes map[string]struct{} `json:"volumes"`

	// Status is the lifecycle state of the node
	Status Status `json:"status"`

	// Tags is a map of arbitrary key=value labels for this node,
	// set at startup and propagated via gossip.
	Tags map[string]string `json:"tags"`
}

Metadata is the metadata that it's send for each node

type State added in v0.3.0

type State struct {
	// Node is the name of the Node
	Node string `json:"node"`

	// Volumes is the list of volumes of the Node with the State
	// each one have
	Volumes map[string]state.State `json:"volume_ids"`

	// Status is the lifecycle state of the node
	Status Status `json:"status"`
}

State holds the node state which will be notified to the other Nodes

type Status added in v0.5.0

type Status string

Status represents the lifecycle state of a node.

const (
	StatusStarting Status = "starting"
	StatusRunning  Status = "running"
	StatusDraining Status = "draining"
)

Jump to

Keyboard shortcuts

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