actors

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindScheduler    = "scheduler"
	KindOrchestrator = "orchestrator"
	KindDispatcher   = "dispatcher"
)

Variables

This section is empty.

Functions

func NewClusterGuardActor

func NewClusterGuardActor(c *cluster.Cluster, onReady func(scheduler, orchestrator, dispatcher *actor.PID), logger gochainedlog.Logger) actor.Producer

NewClusterGuardActor returns a Hollywood Producer that creates a ClusterGuardActor.

func NewDispatcherActor

func NewDispatcherActor(s *store.RedisStore, logger gochainedlog.Logger) actor.Producer

NewDispatcherActor returns a Hollywood Producer that creates a DispatcherActor.

func NewEventBridgeActor

func NewEventBridgeActor(nodeID string, s *store.RedisStore, logger gochainedlog.Logger) actor.Producer

NewEventBridgeActor returns a Hollywood Producer that creates an EventBridgeActor for the given node.

func NewHeartbeatActor

func NewHeartbeatActor(nodeID string, s *store.RedisStore, taskTypes []string, logger gochainedlog.Logger) actor.Producer

NewHeartbeatActor returns a Hollywood Producer that creates a HeartbeatActor.

func NewNotifierActor

func NewNotifierActor(rdb rueidis.Client, channel string, logger gochainedlog.Logger) actor.Producer

NewNotifierActor returns a Hollywood Producer that creates a NotifierActor.

func NewOrchestratorActor

func NewOrchestratorActor(s *store.RedisStore, c *cluster.Cluster, logger gochainedlog.Logger) actor.Producer

NewOrchestratorActor returns a Hollywood Producer that creates an OrchestratorActor. The cluster reference is used to discover the DispatcherActor PID at runtime.

func NewSchedulerActor

func NewSchedulerActor(s *store.RedisStore, c *cluster.Cluster, logger gochainedlog.Logger) actor.Producer

NewSchedulerActor returns a Hollywood Producer that creates a SchedulerActor. The cluster reference is used to discover the DispatcherActor PID at runtime.

func NewWorkerActor

func NewWorkerActor(work *pb.ExecuteJobMsg, handler types.HandlerDefinition, s *store.RedisStore, nodeID string, locker *lock.Locker, logger gochainedlog.Logger) actor.Producer

NewWorkerActor returns a Hollywood Producer that creates a WorkerActor for the given job execution message.

func NewWorkerSupervisorActor

func NewWorkerSupervisorActor(nodeID string, s *store.RedisStore, registry HandlerRegistry, maxConcurrency int, locker *lock.Locker, logger gochainedlog.Logger) actor.Producer

NewWorkerSupervisorActor returns a Hollywood Producer that creates a WorkerSupervisorActor for the given node.

Types

type ClusterGuardActor

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

ClusterGuardActor runs one per node. It activates the cluster singleton actors (Scheduler, Orchestrator, Dispatcher) and monitors their health. If a singleton becomes unreachable (e.g. the hosting member crashed), it re-activates the singleton so the cluster auto-places it on a live member.

func (*ClusterGuardActor) Receive

func (g *ClusterGuardActor) Receive(ctx *actor.Context)

Receive implements actor.Receiver.

type DispatcherActor

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

DispatcherActor is a cluster singleton that receives job dispatch requests and routes them to the WorkerSupervisorActor on the node with the most available capacity for the requested task type.

func (*DispatcherActor) Receive

func (d *DispatcherActor) Receive(ctx *actor.Context)

Receive implements actor.Receiver.

func (*DispatcherActor) SetEventBridgePID

func (d *DispatcherActor) SetEventBridgePID(pid *actor.PID)

SetEventBridgePID sets the PID of the EventBridgeActor for publishing events.

type EventBridgeActor

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

EventBridgeActor runs one per node. It receives job results and domain events, persists them to Redis, and forwards domain events to the OrchestratorActor singleton.

func (*EventBridgeActor) Receive

func (eb *EventBridgeActor) Receive(ctx *actor.Context)

Receive implements actor.Receiver.

func (*EventBridgeActor) SetOrchestratorPID

func (eb *EventBridgeActor) SetOrchestratorPID(pid *actor.PID)

SetOrchestratorPID sets the PID of the OrchestratorActor so domain events can be forwarded to it. Called by the server during wiring.

type HandlerRegistry

type HandlerRegistry interface {
	Get(taskType types.TaskType) (*types.HandlerDefinition, bool)
	TaskTypes() []string
}

HandlerRegistry is the interface for looking up task handlers by type.

type HeartbeatActor

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

HeartbeatActor periodically saves NodeInfo to Redis so the monitoring API can discover live worker nodes. One instance runs per node.

func (*HeartbeatActor) Receive

func (h *HeartbeatActor) Receive(ctx *actor.Context)

Receive implements actor.Receiver.

type NotifierActor

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

NotifierActor runs one per node. It subscribes to a Redis Pub/Sub channel for new job notifications and forwards them as NewJobNotification messages to the DispatcherActor.

func (*NotifierActor) Receive

func (n *NotifierActor) Receive(ctx *actor.Context)

Receive implements actor.Receiver.

func (*NotifierActor) SetDispatcherPID

func (n *NotifierActor) SetDispatcherPID(pid *actor.PID)

SetDispatcherPID sets the PID of the DispatcherActor so new job notifications can be forwarded to it. Called by the server during wiring.

type OrchestratorActor

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

OrchestratorActor is a cluster singleton that handles workflow DAG execution and batch processing. It receives domain events (job completed/failed) and advances the state machines for workflows and batches accordingly.

func (*OrchestratorActor) Receive

func (o *OrchestratorActor) Receive(ctx *actor.Context)

Receive implements actor.Receiver.

type SchedulerActor

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

SchedulerActor is a cluster singleton that periodically checks for due schedules and dispatches jobs. It also detects orphaned runs whose owning node has disappeared or whose heartbeat has gone stale.

func (*SchedulerActor) Receive

func (s *SchedulerActor) Receive(ctx *actor.Context)

Receive implements actor.Receiver.

type WorkerActor

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

WorkerActor is a short-lived, per-job child of WorkerSupervisorActor. It executes a single job handler, manages run lifecycle bookkeeping, and reports the result back to its parent.

func (*WorkerActor) Receive

func (w *WorkerActor) Receive(ctx *actor.Context)

Receive implements actor.Receiver.

type WorkerSupervisorActor

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

WorkerSupervisorActor runs one per node. It manages the pool of WorkerActor children, enforces concurrency limits, and routes job results to the EventBridgeActor.

func (*WorkerSupervisorActor) Receive

func (ws *WorkerSupervisorActor) Receive(ctx *actor.Context)

Receive implements actor.Receiver.

func (*WorkerSupervisorActor) SetDispatcherPID

func (ws *WorkerSupervisorActor) SetDispatcherPID(pid *actor.PID)

SetDispatcherPID sets the PID of the DispatcherActor so capacity reports can be sent to it. Called by the server during wiring.

func (*WorkerSupervisorActor) SetEventBridgePID

func (ws *WorkerSupervisorActor) SetEventBridgePID(pid *actor.PID)

SetEventBridgePID sets the PID of the EventBridgeActor so job results can be forwarded to it. Called by the server during wiring.

Jump to

Keyboard shortcuts

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