fact

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package fact contains structures that represents internal engine events. They are named facts to prevent ambiguity with Dogma application events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateInstanceCreated

type AggregateInstanceCreated struct {
	Handler    configkit.RichAggregate
	InstanceID string
	Root       dogma.AggregateRoot
	Envelope   *envelope.Envelope
}

AggregateInstanceCreated indicates that an aggregate message handler created an aggregate instance while handling a command.

type AggregateInstanceDestroyed

type AggregateInstanceDestroyed struct {
	Handler    configkit.RichAggregate
	InstanceID string
	Root       dogma.AggregateRoot
	Envelope   *envelope.Envelope
}

AggregateInstanceDestroyed indicates that an aggregate message handler destroyed an aggregate instance while handling a command.

type AggregateInstanceDestructionReverted added in v0.13.0

type AggregateInstanceDestructionReverted struct {
	Handler    configkit.RichAggregate
	InstanceID string
	Root       dogma.AggregateRoot
	Envelope   *envelope.Envelope
}

AggregateInstanceDestructionReverted indicates that an aggregate message handler "reverted" destruction of an aggregate instance by recording a new event.

type AggregateInstanceLoaded

type AggregateInstanceLoaded struct {
	Handler    configkit.RichAggregate
	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    configkit.RichAggregate
	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.

func (*Buffer) Facts

func (b *Buffer) Facts() []Fact

Facts returns the facts that have been buffered so far.

func (*Buffer) Notify

func (b *Buffer) Notify(f Fact)

Notify appends f to b.Facts.

type CommandExecutedByProcess

type CommandExecutedByProcess struct {
	Handler         configkit.RichProcess
	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

type DispatchBegun struct {
	Envelope *envelope.Envelope
}

DispatchBegun indicates that Engine.Dispatch() has been called with a message that is able to be routed to at least one handler.

type DispatchCompleted

type DispatchCompleted struct {
	Envelope *envelope.Envelope
	Error    error
}

DispatchCompleted indicates that a call Engine.Dispatch() has completed.

type DispatchCycleBegun

type DispatchCycleBegun struct {
	Envelope            *envelope.Envelope
	EngineTime          time.Time
	EnabledHandlerTypes map[configkit.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[configkit.HandlerType]bool
	EnabledHandlers     map[string]bool
}

DispatchCycleCompleted indicates that a call Engine.Dispatch() has completed.

type EventRecordedByAggregate

type EventRecordedByAggregate struct {
	Handler       configkit.RichAggregate
	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       configkit.RichIntegration
	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.
	HandlerTypeDisabled HandlerSkipReason = 'T'

	// IndividualHandlerDisabled indicates that a handler was skipped because
	// that specific handler was disabled.
	IndividualHandlerDisabled HandlerSkipReason = 'I'
)

type HandlingBegun

type HandlingBegun struct {
	Handler  configkit.RichHandler
	Envelope *envelope.Envelope
}

HandlingBegun indicates that a message is about to be handled by a specific handler.

type HandlingCompleted

type HandlingCompleted struct {
	Handler  configkit.RichHandler
	Envelope *envelope.Envelope
	Error    error
}

HandlingCompleted indicates that a message has been handled by a specific handler, either successfully or unsuccessfully.

type HandlingSkipped

type HandlingSkipped struct {
	Handler  configkit.RichHandler
	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.

func NewLogger

func NewLogger(log func(string)) *Logger

NewLogger returns a new observer that logs human-readable descriptions of facts to the given log function.

func (*Logger) Notify

func (l *Logger) Notify(f Fact)

Notify the observer of a fact.generates the log message for f.

type MessageLoggedByAggregate

type MessageLoggedByAggregate struct {
	Handler      configkit.RichAggregate
	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      configkit.RichIntegration
	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      configkit.RichProcess
	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      configkit.RichProjection
	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.

func (ObserverFunc) Notify

func (fn ObserverFunc) Notify(f Fact)

Notify calls fn(f).

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

type ProcessEventIgnored struct {
	Handler  configkit.RichProcess
	Envelope *envelope.Envelope
}

ProcessEventIgnored indicates that a process message handler chose not to route an event to any instance.

type ProcessInstanceBegun

type ProcessInstanceBegun struct {
	Handler    configkit.RichProcess
	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    configkit.RichProcess
	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    configkit.RichProcess
	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    configkit.RichProcess
	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    configkit.RichProcess
	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 ProcessTimeoutIgnored

type ProcessTimeoutIgnored struct {
	Handler    configkit.RichProcess
	InstanceID string
	Envelope   *envelope.Envelope
}

ProcessTimeoutIgnored indicates that a process message handler ignored a timeout message because its instance no longer exists.

type ProjectionCompactionBegun

type ProjectionCompactionBegun struct {
	Handler configkit.RichProjection
}

ProjectionCompactionBegun indicates that a projection is about to be compacted.

type ProjectionCompactionCompleted

type ProjectionCompactionCompleted struct {
	Handler configkit.RichProjection
	Error   error
}

ProjectionCompactionCompleted indicates that projection compaction has been performed, either successfully or unsuccessfully.

type TickBegun

type TickBegun struct {
	Handler configkit.RichHandler
}

TickBegun indicates that a call to Controller.Tick() is being made.

type TickCompleted

type TickCompleted struct {
	Handler configkit.RichHandler
	Error   error
}

TickCompleted indicates that a call to Controller.Tick() has completed.

type TickCycleBegun

type TickCycleBegun struct {
	EngineTime          time.Time
	EnabledHandlerTypes map[configkit.HandlerType]bool
	EnabledHandlers     map[string]bool
}

TickCycleBegun indicates that Engine.Tick() has been called.

type TickCycleCompleted

type TickCycleCompleted struct {
	Error               error
	EnabledHandlerTypes map[configkit.HandlerType]bool
	EnabledHandlers     map[string]bool
}

TickCycleCompleted indicates that a call Engine.Tick() has completed.

type TickSkipped

type TickSkipped struct {
	Handler configkit.RichHandler
	Reason  HandlerSkipReason
}

TickSkipped indicates that a call to Controller.Tick() has been skipped, either because all handlers of that type are or the handler itself is disabled.

type TimeoutScheduledByProcess

type TimeoutScheduledByProcess struct {
	Handler         configkit.RichProcess
	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.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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