Documentation
¶
Index ¶
- Constants
- type Actor
- type ActorMonitor
- type ActorRegistry
- type ActorResult
- type BasicActor
- func (a *BasicActor) GetContext() context.Context
- func (a *BasicActor) GetID() uuid.UUID
- func (a *BasicActor) GetName() string
- func (a *BasicActor) SendMessage(msg interface{})
- func (a *BasicActor) SetContext(ctx context.Context)
- func (a *BasicActor) SetFailureChannel(failure chan *ActorResult)
- func (a *BasicActor) SetWaitGroup(wg *sync.WaitGroup)
- func (a *BasicActor) Start()
- func (a *BasicActor) Stop()
- type InMemoryBroker
- type MessageBroker
- type Supervisor
- type SupervisorActorResult
- type SupervisorMonitor
Constants ¶
const ( ACTOR_RESTART = iota ACTOR_RETRY ACTOR_FAIL )
const ( SUPERVISOR_RESTART = iota SUPERVISOR_FAIL SUPERVISOR_IGNORE )
const DefaultRegistrySize = 100
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActorMonitor ¶
type ActorMonitor struct {
// contains filtered or unexported fields
}
ActorMonitor manages communication between actors and their supervisor
func NewActorMonitor ¶
func NewActorMonitor(s *Supervisor) *ActorMonitor
NewActorMonitor creates a new monitor for actors
func (*ActorMonitor) GetInboundChannel ¶
func (m *ActorMonitor) GetInboundChannel() chan *ActorResult
type ActorRegistry ¶
func NewActorRegistry ¶
func NewActorRegistry(size ...int) *ActorRegistry
func (*ActorRegistry) RegisterActor ¶
func (ar *ActorRegistry) RegisterActor(actor Actor)
type ActorResult ¶
type BasicActor ¶
type BasicActor struct { ReceiveFunc func(result *ActorResult) *ActorResult // contains filtered or unexported fields }
func NewBasicActor ¶
func NewBasicActor(name string) *BasicActor
recieveFunc func(result *ActorResult) *ActorResult
func NewBasicActorWithMailboxSize ¶
func NewBasicActorWithMailboxSize(name string, size int) *BasicActor
func (*BasicActor) GetContext ¶ added in v0.0.4
func (a *BasicActor) GetContext() context.Context
func (*BasicActor) GetID ¶
func (a *BasicActor) GetID() uuid.UUID
func (*BasicActor) GetName ¶
func (a *BasicActor) GetName() string
func (*BasicActor) SendMessage ¶
func (a *BasicActor) SendMessage(msg interface{})
func (*BasicActor) SetContext ¶
func (a *BasicActor) SetContext(ctx context.Context)
func (*BasicActor) SetFailureChannel ¶
func (a *BasicActor) SetFailureChannel(failure chan *ActorResult)
func (*BasicActor) SetWaitGroup ¶
func (a *BasicActor) SetWaitGroup(wg *sync.WaitGroup)
func (*BasicActor) Start ¶
func (a *BasicActor) Start()
func (*BasicActor) Stop ¶
func (a *BasicActor) Stop()
type InMemoryBroker ¶
type InMemoryBroker struct {
// contains filtered or unexported fields
}
InMemoryBroker is an in-memory implementation of the MessageBroker interface
func NewInMemoryBroker ¶
func NewInMemoryBroker() *InMemoryBroker
NewInMemoryBroker creates a new in-memory broker
func (*InMemoryBroker) Publish ¶
func (b *InMemoryBroker) Publish(topic string, msg interface{}) error
Publish sends a message to all actors subscribed to the topic
type MessageBroker ¶
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
func NewSupervisor ¶
func NewSupervisor(ctx context.Context) *Supervisor
NewSupervisor creates a new supervisor with an optional timeout
func (*Supervisor) GetID ¶
func (s *Supervisor) GetID() uuid.UUID
func (*Supervisor) Stop ¶
func (s *Supervisor) Stop()
Stop gracefully stops all actors and nested supervisors
func (*Supervisor) SuperviseActor ¶
func (s *Supervisor) SuperviseActor(actor Actor)
SuperviseActor adds an actor to the supervisor and starts it
func (*Supervisor) SuperviseSupervisor ¶
func (s *Supervisor) SuperviseSupervisor(subSupervisor *Supervisor)
SuperviseSupervisor adds a nested supervisor (creating a hierarchy)
type SupervisorActorResult ¶
type SupervisorActorResult struct { Action int Result *ActorResult }
type SupervisorMonitor ¶
type SupervisorMonitor struct {
// contains filtered or unexported fields
}
SupervisorMonitor manages communication between supervisors
func NewSupervisorMonitor ¶
func NewSupervisorMonitor(s *Supervisor) *SupervisorMonitor
NewSupervisorMonitor creates a new monitor for supervisors
func (*SupervisorMonitor) GetInboundChannel ¶
func (m *SupervisorMonitor) GetInboundChannel() chan *SupervisorActorResult
func (*SupervisorMonitor) GetOutboundChannel ¶
func (m *SupervisorMonitor) GetOutboundChannel() chan *SupervisorActorResult
func (*SupervisorMonitor) SetOutboundChannel ¶
func (m *SupervisorMonitor) SetOutboundChannel(outbound chan *SupervisorActorResult)