Documentation
¶
Index ¶
- Constants
- type Cluster
- func (c *Cluster) BroadcastEvent(envelope *service.EventEnvelope)
- func (c *Cluster) CalcLeafPayloadSize(totalNodes int) int
- func (c *Cluster) DoCommandFullSync(node *gossip.Node) error
- func (c *Cluster) DoConversationFullSync(node *gossip.Node) error
- func (c *Cluster) DoEventSinkFullSync(node *gossip.Node) error
- func (c *Cluster) DoGroupFullSync(node *gossip.Node) error
- func (c *Cluster) DoMCPServerFullSync(node *gossip.Node) error
- func (c *Cluster) DoPoolDefinitionFullSync(node *gossip.Node) error
- func (c *Cluster) DoResponseFullSync(node *gossip.Node) error
- func (c *Cluster) DoRoleFullSync(node *gossip.Node) error
- func (c *Cluster) DoScriptFullSync(node *gossip.Node) error
- func (c *Cluster) DoSessionFullSync(node *gossip.Node) error
- func (c *Cluster) DoSkillFullSync(node *gossip.Node) error
- func (c *Cluster) DoSpaceFullSync(node *gossip.Node) error
- func (c *Cluster) DoSpaceUsageFullSync(node *gossip.Node) error
- func (c *Cluster) DoStackDefinitionFullSync(node *gossip.Node) error
- func (c *Cluster) DoTemplateFullSync(node *gossip.Node) error
- func (c *Cluster) DoTemplateVarFullSync(node *gossip.Node) error
- func (c *Cluster) DoTokenFullSync(node *gossip.Node) error
- func (c *Cluster) DoUserFullSync(node *gossip.Node) error
- func (c *Cluster) DoVolumeFullSync(node *gossip.Node) error
- func (c *Cluster) EnqueueSpaceCleanup(space *model.Space)
- func (c *Cluster) GetAgentEndpoints() []string
- func (c *Cluster) GetLocalNodeId() (string, error)
- func (c *Cluster) GetNodeByIDString(id string) *gossip.Node
- func (c *Cluster) GetTunnelServers() []string
- func (c *Cluster) GossipAuditLog(entry *model.AuditLogEntry)
- func (c *Cluster) GossipAuthFailure(evt *authratelimit.Event)
- func (c *Cluster) GossipCommand(command *model.Command)
- func (c *Cluster) GossipConversation(conv *model.Conversation)
- func (c *Cluster) GossipEventSink(sink *model.EventSink)
- func (c *Cluster) GossipGroup(group *model.Group)
- func (c *Cluster) GossipMCPServer(server *model.MCPServer)
- func (c *Cluster) GossipPoolDefinition(pool *model.PoolDefinition)
- func (c *Cluster) GossipPoolDrain(spaceID string)
- func (c *Cluster) GossipPoolUndrain(spaceID string)
- func (c *Cluster) GossipResponse(response *model.Response)
- func (c *Cluster) GossipRole(role *model.Role)
- func (c *Cluster) GossipScript(script *model.Script)
- func (c *Cluster) GossipSession(session *model.Session)
- func (c *Cluster) GossipSkill(skill *model.Skill)
- func (c *Cluster) GossipSpace(space *model.Space)
- func (c *Cluster) GossipSpaceUsageSample(sample *model.SpaceUsageSample)
- func (c *Cluster) GossipStackDefinition(stackDef *model.StackDefinition)
- func (c *Cluster) GossipTemplate(template *model.Template)
- func (c *Cluster) GossipTemplateVar(templateVar *model.TemplateVar)
- func (c *Cluster) GossipToken(token *model.Token)
- func (c *Cluster) GossipUser(user *model.User)
- func (c *Cluster) GossipVolume(volume *model.Volume)
- func (c *Cluster) HandleLeafServer(w http.ResponseWriter, r *http.Request)
- func (c *Cluster) IsLeader() bool
- func (c *Cluster) LockResource(resourceId string) string
- func (c *Cluster) Nodes() []*gossip.Node
- func (c *Cluster) NotifyEventDone(eventId string)
- func (c *Cluster) Start(peers []string, originServer string, originToken string)
- func (c *Cluster) Stop()
- func (c *Cluster) UnlockResource(resourceId, unlockToken string)
- type PoolDrainRequest
- type ResourceLock
Constants ¶
const ( LEAF_PING_INTERVAL = 2 * time.Second RECONNECT_DELAY = 5 * time.Second )
const ( GroupFullSyncMsg gossip.MessageType = iota + gossip.UserMsg GroupGossipMsg RoleFullSyncMsg RoleGossipMsg SpaceFullSyncMsg SpaceGossipMsg TemplateFullSyncMsg TemplateGossipMsg TemplateVarFullSyncMsg TemplateVarGossipMsg UserFullSyncMsg UserGossipMsg TokenFullSyncMsg TokenGossipMsg SessionFullSyncMsg SessionGossipMsg VolumeFullSyncMsg VolumeGossipMsg AuditLogGossipMsg ScriptFullSyncMsg ScriptGossipMsg SkillFullSyncMsg SkillGossipMsg CommandFullSyncMsg CommandGossipMsg StackDefinitionFullSyncMsg StackDefinitionGossipMsg ResponseFullSyncMsg ResponseGossipMsg SpaceUsageFullSyncMsg SpaceUsageGossipMsg SpaceMigrationStartMsg PoolDefinitionFullSyncMsg PoolDefinitionGossipMsg PoolDrainMsg EventSinkFullSyncMsg EventSinkGossipMsg EventBroadcastMsg EventDoneMsg InFlightStateMsg ConversationFullSyncMsg ConversationGossipMsg MCPServerFullSyncMsg MCPServerGossipMsg AuthFailureGossipMsg )
const ( // ResourceLockTTL is how long a resource lock is held before it expires. // In cluster mode it is the TTL given to the distributed lock (generous, // so container operations that pull images comfortably fit inside it); in // single-process mode it bounds how long an abandoned local lock can wedge // its resource. ResourceLockTTL = 5 * time.Minute ResourceLockGCInterval = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewCluster ¶
func (*Cluster) BroadcastEvent ¶ added in v0.28.0
func (c *Cluster) BroadcastEvent(envelope *service.EventEnvelope)
func (*Cluster) CalcLeafPayloadSize ¶
This is a duplicate of the gossip payload size calculation, however when gossip isn't running we still need this for sending to leaf nodes
func (*Cluster) DoCommandFullSync ¶ added in v0.29.0
func (*Cluster) DoConversationFullSync ¶ added in v0.29.0
func (*Cluster) DoEventSinkFullSync ¶ added in v0.28.0
func (*Cluster) DoMCPServerFullSync ¶ added in v0.29.0
func (*Cluster) DoPoolDefinitionFullSync ¶ added in v0.28.0
func (*Cluster) DoResponseFullSync ¶ added in v0.23.0
func (*Cluster) DoScriptFullSync ¶ added in v0.23.0
func (*Cluster) DoSkillFullSync ¶ added in v0.23.0
func (*Cluster) DoSpaceUsageFullSync ¶ added in v0.24.0
func (*Cluster) DoStackDefinitionFullSync ¶ added in v0.24.0
func (*Cluster) DoTemplateVarFullSync ¶
func (*Cluster) EnqueueSpaceCleanup ¶ added in v0.25.0
func (*Cluster) GetAgentEndpoints ¶
func (*Cluster) GetLocalNodeId ¶ added in v0.22.0
func (*Cluster) GetNodeByIDString ¶ added in v0.22.0
func (*Cluster) GetTunnelServers ¶
func (*Cluster) GossipAuditLog ¶
func (c *Cluster) GossipAuditLog(entry *model.AuditLogEntry)
func (*Cluster) GossipAuthFailure ¶ added in v0.33.0
func (c *Cluster) GossipAuthFailure(evt *authratelimit.Event)
func (*Cluster) GossipCommand ¶ added in v0.29.0
func (*Cluster) GossipConversation ¶ added in v0.29.0
func (c *Cluster) GossipConversation(conv *model.Conversation)
func (*Cluster) GossipEventSink ¶ added in v0.28.0
func (*Cluster) GossipGroup ¶
func (*Cluster) GossipMCPServer ¶ added in v0.29.0
func (*Cluster) GossipPoolDefinition ¶ added in v0.28.0
func (c *Cluster) GossipPoolDefinition(pool *model.PoolDefinition)
GossipPoolDefinition fans a pool definition change out to the cluster and notifies local SSE clients. It is the single choke point for local mutations (Create/SetSize/Start/Stop/Delete/UpdateStartupScript all route through it), so publishing the SSE event here ensures the editing server's other clients refresh immediately; mergePoolDefinitions does the same on receiving servers.
func (*Cluster) GossipPoolDrain ¶ added in v0.28.0
func (*Cluster) GossipPoolUndrain ¶ added in v0.28.0
func (*Cluster) GossipResponse ¶ added in v0.23.0
func (*Cluster) GossipRole ¶
func (*Cluster) GossipScript ¶ added in v0.23.0
func (*Cluster) GossipSession ¶
func (*Cluster) GossipSkill ¶ added in v0.23.0
func (*Cluster) GossipSpace ¶
func (*Cluster) GossipSpaceUsageSample ¶ added in v0.24.0
func (c *Cluster) GossipSpaceUsageSample(sample *model.SpaceUsageSample)
func (*Cluster) GossipStackDefinition ¶ added in v0.24.0
func (c *Cluster) GossipStackDefinition(stackDef *model.StackDefinition)
func (*Cluster) GossipTemplate ¶
func (*Cluster) GossipTemplateVar ¶
func (c *Cluster) GossipTemplateVar(templateVar *model.TemplateVar)
func (*Cluster) GossipToken ¶
func (*Cluster) GossipUser ¶
func (*Cluster) GossipVolume ¶
func (*Cluster) HandleLeafServer ¶
func (c *Cluster) HandleLeafServer(w http.ResponseWriter, r *http.Request)
func (*Cluster) LockResource ¶
LockResource takes a distributed lock on the given resource. In cluster mode the lock is granted by the zone's elected leader and replicated across the zone, so it survives leader failover; the returned token is opaque and must be passed to UnlockResource. An empty token means the lock was not acquired — either it is held elsewhere or leadership is unavailable.
Outside cluster mode (leaf nodes, and zones of one server where the election never starts) the lock is local to this process, which is sufficient because no other process contends for it.
func (*Cluster) NotifyEventDone ¶ added in v0.28.0
NotifyEventDone sends an immediate notification to all zone members that an event is fully delivered. Called by the leader via the Transport interface.
func (*Cluster) UnlockResource ¶
UnlockResource releases a lock previously granted by LockResource.
type PoolDrainRequest ¶ added in v0.28.0
type ResourceLock ¶
type ResourceLock struct {
Id string
UnlockToken string
IsDeleted bool
ExpiresAfter time.Time
UpdatedAt hlc.Timestamp
}
ResourceLock is the local, single-process lock record used when the cluster is not running (leaf nodes, single-server zones). Cluster-mode locking is handled by the distributed lock pool in the gossip lock package; see Cluster.LockResource.
Source Files
¶
- auditlog.go
- authfailure.go
- cluster.go
- commands.go
- conversation.go
- event_sinks.go
- event_state.go
- groups.go
- leafclient.go
- leafserver.go
- mcpservers.go
- msgtypes.go
- pools.go
- resoucelocks.go
- responses.go
- roles.go
- scripts.go
- session.go
- sessions.go
- skills.go
- space_usage.go
- spaces.go
- stack_definitions.go
- templates.go
- templatevars.go
- tokens.go
- users.go
- volumes.go