cluster

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cluster holds the shared domain types for go-faster/fs cluster mode: the failure-domain topology (rack → server → disk) that the etcd control plane publishes and the placement function consumes. It has no external dependencies and no I/O — the etcd integration and the replication transport live in sibling packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Disk

type Disk struct {
	// ID identifies the disk within its node.
	ID DiskID
	// Weight is the relative capacity weight used by weighted placement. A disk
	// with weight <= 0 is drained: it is never chosen for new placement (used
	// when decommissioning or when a disk is full/faulted).
	Weight float64
	// TotalBytes/FreeBytes are the disk's reported filesystem capacity,
	// refreshed by its node's registration; 0/0 means unknown. Observability
	// input only — placement uses Weight, and Signature ignores capacity so
	// usage churn never reads as a membership change.
	TotalBytes uint64
	FreeBytes  uint64
}

Disk is one storage device on a node.

type DiskID

type DiskID string

DiskID uniquely identifies a disk. It only needs to be unique within its node; placement treats (NodeID, DiskID) as the physical target.

type Node

type Node struct {
	// ID identifies the node.
	ID NodeID
	// Addr is the node's cluster-listener address (host:port). Placement does
	// not use it; it is carried for the caller that dispatches to targets.
	Addr string
	// Rack is the failure-domain label. Nodes sharing a rack share fate (power,
	// switch); an empty rack means "unknown", treated as its own single domain
	// keyed by node so such nodes never falsely appear rack-diverse.
	Rack string
	// Disks are the node's storage devices.
	Disks []Disk
}

Node is a cluster member and the disks it exposes. Rack is its coarsest failure domain; placement spreads copies across distinct racks first, then distinct nodes, then distinct disks.

func (Node) FailureDomain

func (n Node) FailureDomain() string

FailureDomain returns the node's coarsest failure-domain key: its rack, or a node-specific key when the rack is unset so unlabeled nodes are never treated as sharing a rack (they degrade to node-level spread instead of falsely appearing rack-diverse).

type NodeID

type NodeID string

NodeID uniquely identifies a cluster member.

type Topology

type Topology struct {
	// Epoch is the monotonically increasing version of this snapshot (the etcd
	// revision it was derived from). Placement output is stable within an epoch.
	Epoch uint64
	// Nodes are the members. Order is not significant to placement.
	Nodes []Node
}

Topology is an immutable snapshot of cluster membership at a given placement epoch. It is produced by the control plane (etcd revision → epoch) and is a pure input to placement; callers must not mutate a Topology after publishing it.

func (*Topology) DiskCount

func (t *Topology) DiskCount() int

DiskCount reports the number of disks across all nodes, including drained ones.

func (*Topology) Signature

func (t *Topology) Signature() string

Signature is a stable digest of everything placement depends on: node IDs, racks, disk IDs and weights — sorted, so registration order does not matter. Addresses and the epoch are excluded: a node re-registering at a new address (or any registry churn that bumps the epoch without changing membership) moves no data and must not read as a placement change. Equal signatures ⇒ identical placement for every object.

Directories

Path Synopsis
Package diskstore is the filesystem-backed fragment store for go-faster/fs cluster mode: the durable transport.Store a production node serves its fragments from, one root directory per disk.
Package diskstore is the filesystem-backed fragment store for go-faster/fs cluster mode: the durable transport.Store a production node serves its fragments from, one root directory per disk.
Package etcd is the go-faster/fs cluster control plane: the only component that talks to etcd.
Package etcd is the go-faster/fs cluster control plane: the only component that talks to etcd.
Package fragment is the connective layer between placement and the erasure schemes: it encodes an object into the per-target fragments a scheme stores, and reconstructs the object from whatever fragments survive.
Package fragment is the connective layer between placement and the erasure schemes: it encodes an object into the per-target fragments a scheme stores, and reconstructs the object from whatever fragments survive.
Package placement is the pure, failure-domain-aware placement function for go-faster/fs cluster mode (DESIGN.md FR-16).
Package placement is the pure, failure-domain-aware placement function for go-faster/fs cluster mode (DESIGN.md FR-16).
Package scheme models the go-faster/fs replication and erasure schemes (DESIGN.md FR-17) and implements the pure codecs they need.
Package scheme models the go-faster/fs replication and erasure schemes (DESIGN.md FR-17) and implements the pure codecs they need.
Package transport is the peer replication transport for go-faster/fs cluster mode: the internal HTTP API nodes use to store, fetch and delete object fragments on each other (the payloads produced by internal/cluster/fragment).
Package transport is the peer replication transport for go-faster/fs cluster mode: the internal HTTP API nodes use to store, fetch and delete object fragments on each other (the payloads produced by internal/cluster/fragment).

Jump to

Keyboard shortcuts

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