Documentation
¶
Overview ¶
Package fact contains structures that represents internal engine events. They are named facts to prevent ambiguity with Dogma application events.
Index ¶
- type AggregateInstanceCreated
- type AggregateInstanceLoaded
- type AggregateInstanceNotFound
- type Buffer
- type CommandExecutedByProcess
- type DispatchBegun
- type DispatchCompleted
- type DispatchCycleBegun
- type DispatchCycleCompleted
- type EventRecordedByAggregate
- type EventRecordedByIntegration
- type Fact
- type HandlerSkipReason
- type HandlingBegun
- type HandlingCompleted
- type HandlingSkipped
- type Logger
- type MessageLoggedByAggregate
- type MessageLoggedByIntegration
- type MessageLoggedByProcess
- type MessageLoggedByProjection
- type Observer
- type ObserverFunc
- type ObserverGroup
- type ProcessEventIgnored
- type ProcessEventRoutedToEndedInstance
- type ProcessInstanceBegun
- type ProcessInstanceEnded
- type ProcessInstanceEndingReverted
- type ProcessInstanceLoaded
- type ProcessInstanceNotFound
- type ProcessTimeoutRoutedToEndedInstance
- type ProjectionCompactionBegun
- type ProjectionCompactionCompleted
- type TickBegun
- type TickCompleted
- type TickCycleBegun
- type TickCycleCompleted
- type TickSkipped
- type TimeoutScheduledByProcess
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateInstanceCreated ¶
type AggregateInstanceCreated struct {
Handler *config.Aggregate
InstanceID string
Root dogma.AggregateRoot
Envelope *envelope.Envelope
}
AggregateInstanceCreated indicates that an aggregate message handler created an aggregate instance while handling a command.
type AggregateInstanceLoaded ¶
type AggregateInstanceLoaded struct {
Handler *config.Aggregate
InstanceID string
Root dogma.AggregateRoot
Envelope *envelope.Envelope
}
AggregateInstanceLoaded indicates that an aggregate message handler has loaded an existing instance in order to handle a command.
type AggregateInstanceNotFound ¶
type AggregateInstanceNotFound struct {
Handler *config.Aggregate
InstanceID string
Envelope *envelope.Envelope
}
AggregateInstanceNotFound indicates that an aggregate message handler was unable to load an existing instance while handling a command.
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is an Observer that buffers facts in-memory.
It may be used by multiple goroutines simultaneously.
type CommandExecutedByProcess ¶
type CommandExecutedByProcess struct {
Handler *config.Process
InstanceID string
Root dogma.ProcessRoot
Envelope *envelope.Envelope
CommandEnvelope *envelope.Envelope
}
CommandExecutedByProcess indicates that a process executed a command while handling an event or timeout.
type DispatchBegun ¶
DispatchBegun indicates that Engine.Dispatch() has been called with a message that is able to be routed to at least one handler.
type DispatchCompleted ¶
DispatchCompleted indicates that a call Engine.Dispatch() has completed.
type DispatchCycleBegun ¶
type DispatchCycleBegun struct {
Envelope *envelope.Envelope
EngineTime time.Time
EnabledHandlerTypes map[config.HandlerType]bool
EnabledHandlers map[string]bool
}
DispatchCycleBegun indicates that Engine.Dispatch() has been called with a message that is able to be routed to at least one handler.
type DispatchCycleCompleted ¶
type DispatchCycleCompleted struct {
Envelope *envelope.Envelope
Error error
EnabledHandlerTypes map[config.HandlerType]bool
EnabledHandlers map[string]bool
}
DispatchCycleCompleted indicates that a call Engine.Dispatch() has completed.
type EventRecordedByAggregate ¶
type EventRecordedByAggregate struct {
Handler *config.Aggregate
InstanceID string
Root dogma.AggregateRoot
Envelope *envelope.Envelope
EventEnvelope *envelope.Envelope
}
EventRecordedByAggregate indicates that an aggregate recorded an event while handling a command.
type EventRecordedByIntegration ¶
type EventRecordedByIntegration struct {
Handler *config.Integration
Envelope *envelope.Envelope
EventEnvelope *envelope.Envelope
}
EventRecordedByIntegration indicates that an integration recorded an event while handling a command.
type Fact ¶
type Fact interface {
}
Fact is an interface for internal engine events that occur while handling Dogma messages.
type HandlerSkipReason ¶
type HandlerSkipReason byte
HandlerSkipReason is an enumeration of the reasons a handler can be skipped while dispatching a message or ticking.
const ( // HandlerTypeDisabled indicates that a handler was skipped because all // handlers of that type have been disabled using an engine option. HandlerTypeDisabled HandlerSkipReason = 'T' // IndividualHandlerDisabled indicates that a handler was skipped because // that specific handler was disabled using an engine option. IndividualHandlerDisabled HandlerSkipReason = 'I' // IndividualHandlerDisabledByConfiguration indicates that a handler was // skipped because it was disabled by a call to Disable() in its Configure() // method. IndividualHandlerDisabledByConfiguration HandlerSkipReason = 'C' )
type HandlingBegun ¶
HandlingBegun indicates that a message is about to be handled by a specific handler.
type HandlingCompleted ¶
HandlingCompleted indicates that a message has been handled by a specific handler, either successfully or unsuccessfully.
type HandlingSkipped ¶
type HandlingSkipped struct {
Handler config.Handler
Envelope *envelope.Envelope
Reason HandlerSkipReason
}
HandlingSkipped indicates that a message has been not been handled by a specific handler, either because all handlers of that type are or the handler itself is disabled.
type Logger ¶
type Logger struct {
Log func(string)
}
Logger is an observer that logs human-readable messages to a log function.
type MessageLoggedByAggregate ¶
type MessageLoggedByAggregate struct {
Handler *config.Aggregate
InstanceID string
Root dogma.AggregateRoot
Envelope *envelope.Envelope
LogFormat string
LogArguments []any
}
MessageLoggedByAggregate indicates that an aggregate wrote a log message while handling a command.
type MessageLoggedByIntegration ¶
type MessageLoggedByIntegration struct {
Handler *config.Integration
Envelope *envelope.Envelope
LogFormat string
LogArguments []any
}
MessageLoggedByIntegration indicates that an integration wrote a log message while handling a command.
type MessageLoggedByProcess ¶
type MessageLoggedByProcess struct {
Handler *config.Process
InstanceID string
Root dogma.ProcessRoot
Envelope *envelope.Envelope
LogFormat string
LogArguments []any
}
MessageLoggedByProcess indicates that a process wrote a log message while handling an event or timeout.
type MessageLoggedByProjection ¶
type MessageLoggedByProjection struct {
Handler *config.Projection
Envelope *envelope.Envelope
LogFormat string
LogArguments []any
}
MessageLoggedByProjection indicates that a projection wrote a log message while handling an event or compacting the projection.
Envelope is nil if the message was logged during compaction.
type Observer ¶
type Observer interface {
// Notify the observer of a fact.
Notify(Fact)
}
Observer is an interface that is notified when facts are recorded.
type ObserverFunc ¶
type ObserverFunc func(Fact)
ObserverFunc is an adaptor to allow the use of a regular function as an observer.
If f is a function with the appropriate signature, ObserverFunc(f) is an Observer that calls f.
var Ignore ObserverFunc = func(Fact) {}
Ignore is an observer that ignores fact notifications.
type ObserverGroup ¶
type ObserverGroup []Observer
ObserverGroup is a collection of observers that can be notified as a group.
func (ObserverGroup) Notify ¶
func (s ObserverGroup) Notify(f Fact)
Notify notifies all of the observers in the set of each of the given fact.
type ProcessEventIgnored ¶
ProcessEventIgnored indicates that a process message handler chose not to route an event to any instance.
type ProcessEventRoutedToEndedInstance ¶ added in v0.19.0
type ProcessEventRoutedToEndedInstance struct {
Handler *config.Process
InstanceID string
Envelope *envelope.Envelope
}
ProcessEventRoutedToEndedInstance indicates that a process message handler ignored an event message because it was routed to an instance that no longer exists.
type ProcessInstanceBegun ¶
type ProcessInstanceBegun struct {
Handler *config.Process
InstanceID string
Root dogma.ProcessRoot
Envelope *envelope.Envelope
}
ProcessInstanceBegun indicates that a process message handler began a process instance while handling an event.
type ProcessInstanceEnded ¶
type ProcessInstanceEnded struct {
Handler *config.Process
InstanceID string
Root dogma.ProcessRoot
Envelope *envelope.Envelope
}
ProcessInstanceEnded indicates that a process message handler destroyed a process instance while handling an event or timeout.
type ProcessInstanceEndingReverted ¶ added in v0.13.0
type ProcessInstanceEndingReverted struct {
Handler *config.Process
InstanceID string
Root dogma.ProcessRoot
Envelope *envelope.Envelope
}
ProcessInstanceEndingReverted indicates that a process message handler "reverted" ending a process instance by executing a new command or scheduling a new timeout.
type ProcessInstanceLoaded ¶
type ProcessInstanceLoaded struct {
Handler *config.Process
InstanceID string
Root dogma.ProcessRoot
Envelope *envelope.Envelope
}
ProcessInstanceLoaded indicates that a process message handler has loaded an existing instance in order to handle an event or timeout.
type ProcessInstanceNotFound ¶
type ProcessInstanceNotFound struct {
Handler *config.Process
InstanceID string
Envelope *envelope.Envelope
}
ProcessInstanceNotFound indicates that a process message handler was unable to load an existing instance while handling an event or timeout.
type ProcessTimeoutRoutedToEndedInstance ¶ added in v0.19.0
type ProcessTimeoutRoutedToEndedInstance struct {
Handler *config.Process
InstanceID string
Envelope *envelope.Envelope
}
ProcessTimeoutRoutedToEndedInstance indicates that a process message handler ignored a timeout message because its instance no longer exists.
type ProjectionCompactionBegun ¶
type ProjectionCompactionBegun struct {
Handler *config.Projection
}
ProjectionCompactionBegun indicates that a projection is about to be compacted.
type ProjectionCompactionCompleted ¶
type ProjectionCompactionCompleted struct {
Handler *config.Projection
Error error
}
ProjectionCompactionCompleted indicates that projection compaction has been performed, either successfully or unsuccessfully.
type TickCompleted ¶
TickCompleted indicates that a call to Controller.Tick() has completed.
type TickCycleBegun ¶
type TickCycleBegun struct {
EngineTime time.Time
EnabledHandlerTypes map[config.HandlerType]bool
EnabledHandlers map[string]bool
}
TickCycleBegun indicates that Engine.Tick() has been called.
type TickCycleCompleted ¶
type TickCycleCompleted struct {
Error error
EnabledHandlerTypes map[config.HandlerType]bool
EnabledHandlers map[string]bool
}
TickCycleCompleted indicates that a call Engine.Tick() has completed.
type TickSkipped ¶
type TickSkipped struct {
Handler config.Handler
Reason HandlerSkipReason
}
TickSkipped indicates that a call to Controller.Tick() has been skipped.
type TimeoutScheduledByProcess ¶
type TimeoutScheduledByProcess struct {
Handler *config.Process
InstanceID string
Root dogma.ProcessRoot
Envelope *envelope.Envelope
TimeoutEnvelope *envelope.Envelope
}
TimeoutScheduledByProcess indicates that a process scheduled a timeout while handling an event or timeout.