cluster

package
v0.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LEAF_PING_INTERVAL = 2 * time.Second
	RECONNECT_DELAY    = 5 * time.Second
)
View Source
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
	ResourceLockFullSyncMsg
	ResourceLockGossipMsg
	ResourceLockMsg
	ResourceUnlockMsg
	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
)
View Source
const (
	ResourceLockTTL        = 1 * 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 NewCluster(
	clusterKey string,
	advertiseAddr string,
	bindAddr string,
	routes *http.ServeMux,
	compress bool,
	allowLeaf bool,
	tcpOnly bool,
) *Cluster

func (*Cluster) BroadcastEvent added in v0.28.0

func (c *Cluster) BroadcastEvent(envelope *service.EventEnvelope)

func (*Cluster) CalcLeafPayloadSize

func (c *Cluster) CalcLeafPayloadSize(totalNodes int) int

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 (c *Cluster) DoCommandFullSync(node *gossip.Node) error

func (*Cluster) DoConversationFullSync added in v0.29.0

func (c *Cluster) DoConversationFullSync(node *gossip.Node) error

func (*Cluster) DoEventSinkFullSync added in v0.28.0

func (c *Cluster) DoEventSinkFullSync(node *gossip.Node) error

func (*Cluster) DoGroupFullSync

func (c *Cluster) DoGroupFullSync(node *gossip.Node) error

func (*Cluster) DoMCPServerFullSync added in v0.29.0

func (c *Cluster) DoMCPServerFullSync(node *gossip.Node) error

func (*Cluster) DoPoolDefinitionFullSync added in v0.28.0

func (c *Cluster) DoPoolDefinitionFullSync(node *gossip.Node) error

func (*Cluster) DoResourceLockFullSync

func (c *Cluster) DoResourceLockFullSync(node *gossip.Node) error

func (*Cluster) DoResponseFullSync added in v0.23.0

func (c *Cluster) DoResponseFullSync(node *gossip.Node) error

func (*Cluster) DoRoleFullSync

func (c *Cluster) DoRoleFullSync(node *gossip.Node) error

func (*Cluster) DoScriptFullSync added in v0.23.0

func (c *Cluster) DoScriptFullSync(node *gossip.Node) error

func (*Cluster) DoSessionFullSync

func (c *Cluster) DoSessionFullSync(node *gossip.Node) error

func (*Cluster) DoSkillFullSync added in v0.23.0

func (c *Cluster) DoSkillFullSync(node *gossip.Node) error

func (*Cluster) DoSpaceFullSync

func (c *Cluster) DoSpaceFullSync(node *gossip.Node) error

func (*Cluster) DoSpaceUsageFullSync added in v0.24.0

func (c *Cluster) DoSpaceUsageFullSync(node *gossip.Node) error

func (*Cluster) DoStackDefinitionFullSync added in v0.24.0

func (c *Cluster) DoStackDefinitionFullSync(node *gossip.Node) error

func (*Cluster) DoTemplateFullSync

func (c *Cluster) DoTemplateFullSync(node *gossip.Node) error

func (*Cluster) DoTemplateVarFullSync

func (c *Cluster) DoTemplateVarFullSync(node *gossip.Node) error

func (*Cluster) DoTokenFullSync

func (c *Cluster) DoTokenFullSync(node *gossip.Node) error

func (*Cluster) DoUserFullSync

func (c *Cluster) DoUserFullSync(node *gossip.Node) error

func (*Cluster) DoVolumeFullSync

func (c *Cluster) DoVolumeFullSync(node *gossip.Node) error

func (*Cluster) EnqueueSpaceCleanup added in v0.25.0

func (c *Cluster) EnqueueSpaceCleanup(space *model.Space)

func (*Cluster) GetAgentEndpoints

func (c *Cluster) GetAgentEndpoints() []string

func (*Cluster) GetLocalNodeId added in v0.22.0

func (c *Cluster) GetLocalNodeId() (string, error)

func (*Cluster) GetNodeByIDString added in v0.22.0

func (c *Cluster) GetNodeByIDString(id string) *gossip.Node

func (*Cluster) GetTunnelServers

func (c *Cluster) GetTunnelServers() []string

func (*Cluster) GossipAuditLog

func (c *Cluster) GossipAuditLog(entry *model.AuditLogEntry)

func (*Cluster) GossipCommand added in v0.29.0

func (c *Cluster) GossipCommand(command *model.Command)

func (*Cluster) GossipConversation added in v0.29.0

func (c *Cluster) GossipConversation(conv *model.Conversation)

func (*Cluster) GossipEventSink added in v0.28.0

func (c *Cluster) GossipEventSink(sink *model.EventSink)

func (*Cluster) GossipGroup

func (c *Cluster) GossipGroup(group *model.Group)

func (*Cluster) GossipMCPServer added in v0.29.0

func (c *Cluster) GossipMCPServer(server *model.MCPServer)

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 (c *Cluster) GossipPoolDrain(spaceID string)

func (*Cluster) GossipPoolUndrain added in v0.28.0

func (c *Cluster) GossipPoolUndrain(spaceID string)

func (*Cluster) GossipResourceLock

func (c *Cluster) GossipResourceLock(resourceLock *ResourceLock)

func (*Cluster) GossipResponse added in v0.23.0

func (c *Cluster) GossipResponse(response *model.Response)

func (*Cluster) GossipRole

func (c *Cluster) GossipRole(role *model.Role)

func (*Cluster) GossipScript added in v0.23.0

func (c *Cluster) GossipScript(script *model.Script)

func (*Cluster) GossipSession

func (c *Cluster) GossipSession(session *model.Session)

func (*Cluster) GossipSkill added in v0.23.0

func (c *Cluster) GossipSkill(skill *model.Skill)

func (*Cluster) GossipSpace

func (c *Cluster) GossipSpace(space *model.Space)

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 (c *Cluster) GossipTemplate(template *model.Template)

func (*Cluster) GossipTemplateVar

func (c *Cluster) GossipTemplateVar(templateVar *model.TemplateVar)

func (*Cluster) GossipToken

func (c *Cluster) GossipToken(token *model.Token)

func (*Cluster) GossipUser

func (c *Cluster) GossipUser(user *model.User)

func (*Cluster) GossipVolume

func (c *Cluster) GossipVolume(volume *model.Volume)

func (*Cluster) HandleLeafServer

func (c *Cluster) HandleLeafServer(w http.ResponseWriter, r *http.Request)

func (*Cluster) IsLeader added in v0.28.0

func (c *Cluster) IsLeader() bool

func (*Cluster) LockResource

func (c *Cluster) LockResource(resourceId string) string

func (*Cluster) Nodes

func (c *Cluster) Nodes() []*gossip.Node

func (*Cluster) NotifyEventDone added in v0.28.0

func (c *Cluster) NotifyEventDone(eventId string)

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) Start

func (c *Cluster) Start(peers []string, originServer string, originToken string)

func (*Cluster) Stop

func (c *Cluster) Stop()

func (*Cluster) UnlockResource

func (c *Cluster) UnlockResource(resourceId, unlockToken string)

type PoolDrainRequest added in v0.28.0

type PoolDrainRequest struct {
	SpaceID string `json:"space_id" msgpack:"space_id"`
	Undrain bool   `json:"undrain" msgpack:"undrain"`
}

type ResourceLock

type ResourceLock struct {
	Id           string
	UnlockToken  string
	IsDeleted    bool
	ExpiresAfter time.Time
	UpdatedAt    hlc.Timestamp
}

type ResourceLockRequestMsg

type ResourceLockRequestMsg struct {
	ResourceId string
}

type ResourceLockResponseMsg

type ResourceLockResponseMsg struct {
	UnlockToken string
}

type ResourceUnlockRequestMsg

type ResourceUnlockRequestMsg struct {
	ResourceId  string
	UnlockToken string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL