Documentation
¶
Overview ¶
Package coordination defines the L2 cluster coordination abstraction. See docs/architecture.md.
Index ¶
Constants ¶
View Source
const ( ProviderRaft = "raft" ProviderEtcd = "etcd" ProviderConsul = "consul" ProviderKubernetes = "kubernetes" ProviderZooKeeper = "zookeeper" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ClusterView ¶
type ClusterView struct {
LeaderID string
LeaderDatabase DatabaseEndpoint
Members []Member
Epoch uint64
ViewID uint64
}
ClusterView is a snapshot of coordination state.
type Coordinator ¶
type Coordinator interface {
Start(ctx context.Context) error
Stop() error
LocalID() string
IsLeader() bool
ClusterView(ctx context.Context) (ClusterView, error)
Watch(ctx context.Context) (<-chan ClusterView, error)
AddMember(ctx context.Context, id string) error
RemoveMember(ctx context.Context, id string) error
// Dynamic cluster config blob — schema TBD (docs/architecture.md §4.1).
GetClusterConfig(ctx context.Context) ([]byte, error)
SetClusterConfig(ctx context.Context, cfg []byte) error
}
Coordinator abstracts cluster membership and leadership regardless of backend (embedded Raft, etcd, …).
type DatabaseEndpoint ¶
DatabaseEndpoint is the replication target for the current primary mysqld/postgres.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package clusterconfig defines the JSON document stored in DCS for dynamic failover policy (shared across MySQL and PostgreSQL).
|
Package clusterconfig defines the JSON document stored in DCS for dynamic failover policy (shared across MySQL and PostgreSQL). |
|
Package etcd provides an etcd-backed coordination.Coordinator (Patroni-style leader lease).
|
Package etcd provides an etcd-backed coordination.Coordinator (Patroni-style leader lease). |
|
Package raftadapter wraps internal/election/raft as coordination.Coordinator.
|
Package raftadapter wraps internal/election/raft as coordination.Coordinator. |
|
Package wire constructs coordination.Coordinator implementations from config.
|
Package wire constructs coordination.Coordinator implementations from config. |
Click to show internal directories.
Click to hide internal directories.