cluster

package
v0.0.0-...-99e730b Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopicInstanceJoined    = "iac:cluster:instances:joined"
	TopicInstanceLeaving   = "iac:cluster:instances:leaving"
	TopicInstanceHeartbeat = "iac:cluster:instances:heartbeat"
	TopicInstanceStatus    = "iac:cluster:instances:status"
	TopicInstanceDiscovery = "iac:cluster:instances:discovery"
	TopicConfigReload      = "iac:cluster:config:reload"
	TopicSessionInvalidate = "iac:cluster:session:invalidate"
)

SignalR topics for cluster communication

Variables

This section is empty.

Functions

func SetGlobalDiscoveryService

func SetGlobalDiscoveryService(service *SignalRDiscoveryService)

SetGlobalDiscoveryService sets the global discovery service instance

func SetGlobalRegistryService

func SetGlobalRegistryService(service *InstanceRegistryService)

SetGlobalRegistryService sets the global registry service instance

Types

type InstanceRegistryService

type InstanceRegistryService struct {
	// contains filtered or unexported fields
}

InstanceRegistryService manages instance registration and discovery

func GetGlobalRegistryService

func GetGlobalRegistryService() *InstanceRegistryService

GetGlobalRegistryService returns the global registry service instance

func NewInstanceRegistryService

func NewInstanceRegistryService(cfg *config.RegistryConfig) (*InstanceRegistryService, error)

NewInstanceRegistryService creates a new instance registry service

func (*InstanceRegistryService) GetAllInstances

func (s *InstanceRegistryService) GetAllInstances(ctx context.Context) ([]*models.InstanceRegistry, error)

GetAllInstances returns all registered instances

func (*InstanceRegistryService) GetClusterStatus

func (s *InstanceRegistryService) GetClusterStatus(ctx context.Context) (*models.ClusterStatus, error)

GetClusterStatus returns the overall cluster status

func (*InstanceRegistryService) GetInstanceByID

func (s *InstanceRegistryService) GetInstanceByID(ctx context.Context, instanceID string) (*models.InstanceRegistry, error)

GetInstanceByID returns a specific instance

func (*InstanceRegistryService) GetInstancesByRole

func (s *InstanceRegistryService) GetInstancesByRole(ctx context.Context, role models.InstanceRole) ([]*models.InstanceRegistry, error)

GetInstancesByRole returns instances with a specific role

func (*InstanceRegistryService) GetLocalInstance

func (s *InstanceRegistryService) GetLocalInstance() *models.InstanceRegistry

GetLocalInstance returns the local instance registry entry

func (*InstanceRegistryService) Start

Start begins the heartbeat and cleanup processes

func (*InstanceRegistryService) Stop

Stop stops the heartbeat and deregisters the instance

func (*InstanceRegistryService) UpdateLocalStatus

func (s *InstanceRegistryService) UpdateLocalStatus(status models.InstanceStatus)

UpdateLocalStatus updates the local instance status

type SignalRDiscoveryService

type SignalRDiscoveryService struct {
	// contains filtered or unexported fields
}

SignalRDiscoveryService provides real-time instance discovery via SignalR

func GetGlobalDiscoveryService

func GetGlobalDiscoveryService() *SignalRDiscoveryService

GetGlobalDiscoveryService returns the global discovery service instance

func NewSignalRDiscoveryService

func NewSignalRDiscoveryService() *SignalRDiscoveryService

NewSignalRDiscoveryService creates a new SignalR discovery service

func (*SignalRDiscoveryService) BroadcastConfigReload

func (s *SignalRDiscoveryService) BroadcastConfigReload(configVersion string) error

BroadcastConfigReload notifies all instances to reload configuration

func (*SignalRDiscoveryService) BroadcastHeartbeat

func (s *SignalRDiscoveryService) BroadcastHeartbeat()

BroadcastHeartbeat sends a heartbeat to all instances

func (*SignalRDiscoveryService) BroadcastSessionInvalidate

func (s *SignalRDiscoveryService) BroadcastSessionInvalidate(sessionID string) error

BroadcastSessionInvalidate notifies all instances to invalidate a session

func (*SignalRDiscoveryService) BroadcastStatusChange

func (s *SignalRDiscoveryService) BroadcastStatusChange(status models.InstanceStatus)

BroadcastStatusChange announces a status change

func (*SignalRDiscoveryService) GetKnownInstanceByID

func (s *SignalRDiscoveryService) GetKnownInstanceByID(instanceID string) *models.InstanceAnnouncement

GetKnownInstanceByID returns a specific known instance

func (*SignalRDiscoveryService) GetKnownInstances

func (s *SignalRDiscoveryService) GetKnownInstances() []*models.InstanceAnnouncement

GetKnownInstances returns all known instances from SignalR discovery

func (*SignalRDiscoveryService) GetKnownInstancesByRole

func (s *SignalRDiscoveryService) GetKnownInstancesByRole(role models.InstanceRole) []*models.InstanceAnnouncement

GetKnownInstancesByRole returns instances with a specific role

func (*SignalRDiscoveryService) OnInstanceJoined

func (s *SignalRDiscoveryService) OnInstanceJoined(callback func(*models.InstanceAnnouncement))

OnInstanceJoined registers a callback for when an instance joins

func (*SignalRDiscoveryService) OnInstanceLeft

func (s *SignalRDiscoveryService) OnInstanceLeft(callback func(string))

OnInstanceLeft registers a callback for when an instance leaves

func (*SignalRDiscoveryService) OnStatusChange

func (s *SignalRDiscoveryService) OnStatusChange(callback func(*models.InstanceAnnouncement))

OnStatusChange registers a callback for status changes

func (*SignalRDiscoveryService) Start

func (s *SignalRDiscoveryService) Start(localInstance *models.InstanceRegistry) error

Start begins the discovery service

func (*SignalRDiscoveryService) Stop

func (s *SignalRDiscoveryService) Stop()

Stop stops the discovery service

Jump to

Keyboard shortcuts

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