Documentation
¶
Overview ¶
Package coordination provides distributed claim, release, and checkpoint primitives for multi-node CogOS clusters.
It implements lease-based ownership of resources and durable checkpointing so that work can be resumed after node restarts or handed off between nodes.
Index ¶
- func AcceptHandoff(workspaceRoot, handoffFile string) error
- func AgentID() string
- func ClaimOwner(workspaceRoot, path string) (string, error)
- func CreateCheckpoint(workspaceRoot, name string) (agentID string, err error)
- func IsClaimed(workspaceRoot, path string) bool
- func ReleaseClaim(workspaceRoot, path string) error
- func WaitCheckpoint(workspaceRoot, name string, agents []string, timeout time.Duration) error
- type Broadcast
- type Claim
- type Handoff
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptHandoff ¶
AcceptHandoff archives a handoff (marks it as accepted)
func AgentID ¶
func AgentID() string
AgentID returns the current agent identifier. It checks COG_AGENT_ID, then USER, defaulting to "root".
func ClaimOwner ¶
ClaimOwner returns the agent that owns the claim
func CreateCheckpoint ¶
CreateCheckpoint creates a checkpoint signal for the current agent. Returns the agent ID and checkpoint name for display purposes.
func ReleaseClaim ¶
ReleaseClaim releases a file lock.
Types ¶
type Broadcast ¶
type Broadcast struct {
Channel string `json:"channel"`
Agent string `json:"agent"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
}
Broadcast represents a channel broadcast message
func CreateBroadcast ¶
CreateBroadcast broadcasts a message to a channel. Returns the created Broadcast on success.
type Claim ¶
type Claim struct {
Path string `json:"path"`
Agent string `json:"agent"`
Reason string `json:"reason"`
ClaimedAt time.Time `json:"claimed_at"`
}
Claim represents a file-level lock for exclusive work
func CreateClaim ¶
CreateClaim acquires a file lock for exclusive work. Returns the created Claim on success.
func ListClaims ¶
ListClaims returns all active claims
type Handoff ¶
type Handoff struct {
From string `json:"from"`
To string `json:"to"`
Artifact string `json:"artifact"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
}
Handoff represents an agent-to-agent handoff
func CreateHandoff ¶
CreateHandoff creates a handoff to another agent. Returns the created Handoff on success.
func ListHandoffs ¶
ListHandoffs returns pending handoffs for an agent. If agent is empty, uses the current agent ID.