Expand description
Cluster coordination and node management.
Forge nodes discover each other via PostgreSQL without external service discovery.
Nodes register in forge_nodes, send heartbeats, and are marked dead if stale.
§Node Roles
Each node can assume one or more roles:
| Role | Responsibility |
|---|---|
| Gateway | HTTP/WebSocket endpoints |
| Function | Query/mutation execution |
| Worker | Background job processing |
| Scheduler | Cron scheduling (singleton via advisory lock) |
§Leader Election
Singleton processes use PostgreSQL advisory locks. Only one node holds the lock at a time. If the leader crashes, PostgreSQL releases the lock and a standby node acquires it.
§Key Types
NodeId- Unique node identifier (UUID)NodeInfo- Node metadata (hostname, roles, capabilities)NodeRole- Role enum (Gateway, Function, Worker, Scheduler)LeaderRole- Singleton role requiring leader election
Structs§
- Cluster
Info - Information about the cluster.
- Leader
Info - Leadership information for a role.
- NodeId
- Unique node identifier.
- Node
Info - Information about a node in the cluster.
- Parse
Leader Role Error - Parse
Node Role Error - Parse
Node Status Error
Enums§
- Leader
Role - Leader role for coordinated operations.
- Node
Role - Node role in the cluster.
- Node
Status - Node status in the cluster.