Skip to content

hero.herocluster #

enum NodeStatus #

enum NodeStatus {
	active
	buffer
	unavailable
}

--- Node & Election ---

struct Election #

struct Election {
pub mut:
	clients      []&redisclient.Redis
	pubkeys      map[string]ed25519.PublicKey
	self         Node
	keys         Keys
	all_nodes    map[string]Node
	buffer_nodes []string
}

fn (Election) health_monitor_loop #

fn (mut e Election) health_monitor_loop()

Health monitoring loop (runs in background)

fn (Election) heartbeat_loop #

fn (mut e Election) heartbeat_loop()

Heartbeat loop

struct Keys #

struct Keys {
pub mut:
	priv ed25519.PrivateKey
	pub  ed25519.PublicKey
}

--- Crypto helpers ---

struct Node #

struct Node {
pub:
	id string
pub mut:
	term      int
	leader    bool
	voted_for string
	status    NodeStatus
	last_seen i64 // timestamp
}