Documentation
¶
Overview ¶
Package raftnode provides an optional HashiCorp Raft cluster adapter for Vale.
Index ¶
- Constants
- Variables
- func WithCluster(config Config) gateway.Option
- type Command
- type Config
- type Node
- func (n *Node) AddVoter(id, address string, timeout time.Duration) error
- func (n *Node) AppliedState() State
- func (n *Node) Apply(data []byte, timeout time.Duration) error
- func (n *Node) IsEnabled() bool
- func (n *Node) IsLeader() bool
- func (n *Node) Peers() (*collectionlist.List[gateway.ClusterPeer], error)
- func (n *Node) RemoveServer(id string, timeout time.Duration) error
- func (n *Node) Shutdown() error
- func (n *Node) Status() *mapping.Map[string, any]
- type Peer
- type RouteRecord
- type SnapshotUpdate
- type State
Constants ¶
View Source
const ( CommandTypeSnapshotUpdate = "snapshot_update" CommandTypeRouteSync = "route_sync" )
Variables ¶
View Source
var ErrDisabled = errors.New("raft disabled")
Functions ¶
func WithCluster ¶
Types ¶
type Command ¶
type Command struct {
Type string `json:"type"`
Snapshot *SnapshotUpdate `json:"snapshot,omitempty"`
Routes *collectionlist.List[RouteRecord] `json:"routes,omitempty"`
Raw json.RawMessage `json:"raw,omitempty"`
}
type Config ¶
func DefaultConfig ¶
func DefaultConfig() Config
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) AppliedState ¶
func (*Node) Peers ¶
func (n *Node) Peers() (*collectionlist.List[gateway.ClusterPeer], error)
type RouteRecord ¶
type SnapshotUpdate ¶
type State ¶
type State struct {
Version uint64 `json:"version"`
AppliedAt time.Time `json:"applied_at"`
Snapshot *SnapshotUpdate `json:"snapshot,omitempty"`
Routes *collectionlist.List[RouteRecord] `json:"routes,omitempty"`
Raw json.RawMessage `json:"raw,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.