Documentation
¶
Overview ¶
Package config builds and represents the configuration of Dogma applications and handlers.
Index ¶
- func Describe(w io.Writer, c Component, options ...DescribeOption) (int, error)
- func Description(c Component, options ...DescribeOption) string
- func ErrorsByComponent(c Component, err error) []error
- func HandlerTypes() iter.Seq[HandlerType]
- func MapByHandlerType[T any](t HandlerType, aggregate T, process T, integration T, projection T) T
- func MapByHandlerTypeOf[T any](h Handler, aggregate func(*Aggregate) T, process func(*Process) T, ...) (result T)
- func MapByHandlerTypeOfWithErr[T any](h Handler, aggregate func(*Aggregate) (T, error), ...) (result T, err error)
- func MapByRouteType[T any](t RouteType, handlesCommand T, handlesEvent T, executesCommand T, ...) T
- func RouteTypes() iter.Seq[RouteType]
- func SwitchByHandlerType(t HandlerType, aggregate func(), process func(), integration func(), ...)
- func SwitchByHandlerTypeOf(h Handler, aggregate func(*Aggregate), process func(*Process), ...)
- func SwitchByRouteType(t RouteType, handlesCommand func(), handlesEvent func(), ...)
- func Validate(c Component, options ...ValidateOption) error
- type Aggregate
- type AmbiguouslyIdentifiedEntityError
- type Application
- type Component
- type ComponentCommon
- type ConcurrencyPreference
- type ConfigurationUnavailableError
- type DescribeOption
- type Disabled
- type DuplicateRouteError
- type Entity
- type EntityCommon
- type Flag
- type Handler
- type HandlerCommon
- type HandlerType
- type Identity
- type IdentityKeyConflictError
- type IdentityNameConflictError
- type Integration
- func (h *Integration) ConcurrencyPreference() dogma.ConcurrencyPreference
- func (h *Integration) HandlerType() HandlerType
- func (h *Integration) Identity() *identitypb.Identity
- func (h *Integration) Interface() dogma.IntegrationMessageHandler
- func (h *Integration) IsDisabled() bool
- func (h *Integration) RouteSet() RouteSet
- func (h *Integration) String() string
- type InvalidComponentError
- type InvalidIdentityKeyError
- type InvalidIdentityNameError
- type MessageKindMismatchError
- type MissingRouteTypeError
- type PartialConfigurationError
- type Process
- type Projection
- func (h *Projection) ConcurrencyPreference() dogma.ConcurrencyPreference
- func (h *Projection) HandlerType() HandlerType
- func (h *Projection) Identity() *identitypb.Identity
- func (h *Projection) Interface() dogma.ProjectionMessageHandler
- func (h *Projection) IsDisabled() bool
- func (h *Projection) RouteSet() RouteSet
- func (h *Projection) String() string
- type Route
- type RouteCapabilities
- type RouteCapability
- type RouteConflictError
- type RouteDirection
- type RouteSet
- func (s RouteSet) DirectionOf(t message.Type) RouteDirection
- func (s RouteSet) Filter(filters ...RouteSetFilter) RouteSet
- func (s RouteSet) HasMessageType(t message.Type) bool
- func (s RouteSet) MessageTypeSet() *sets.Set[message.Type]
- func (s RouteSet) MessageTypes() map[message.Type]RouteDirection
- func (s RouteSet) Routes() iter.Seq2[*Route, Handler]
- type RouteSetFilter
- func FilterByMessageDirection(directions ...RouteDirection) RouteSetFilter
- func FilterByMessageKind(kinds ...message.Kind) RouteSetFilter
- func FilterByMessageType(kinds ...message.Kind) RouteSetFilter
- func FilterByRouteDirection(directions ...RouteDirection) RouteSetFilter
- func FilterByRouteType(types ...RouteType) RouteSetFilter
- type RouteType
- type SpeculativeConfigurationError
- type Symbol
- type UnidentifiedEntityError
- type UnrecognizedConcurrencyPreference
- type UnsupportedRouteTypeError
- type ValidateOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Describe ¶ added in v0.16.2
Describe writes a detailed human-readable description of a Component to w.
func Description ¶ added in v0.16.2
func Description(c Component, options ...DescribeOption) string
Description returns a detailed human-readable description of a Component.
func ErrorsByComponent ¶ added in v0.16.2
ErrorsByComponent returns the errors within err that are directly associated with the given component.
func HandlerTypes ¶ added in v0.16.2
func HandlerTypes() iter.Seq[HandlerType]
HandlerTypes returns a sequence that yields all valid HandlerType values.
func MapByHandlerType ¶ added in v0.16.2
func MapByHandlerType[T any]( t HandlerType, aggregate T, process T, integration T, projection T, ) T
MapByHandlerType maps t to a value of type T.
It provides a compile-time guarantee that all possible values are handled, even if new HandlerType values are added in the future.
It panics if t is not a valid HandlerType.
func MapByHandlerTypeOf ¶ added in v0.16.2
func MapByHandlerTypeOf[T any]( h Handler, aggregate func(*Aggregate) T, process func(*Process) T, integration func(*Integration) T, projection func(*Projection) T, ) (result T)
MapByHandlerTypeOf invokes one of the provided functions based on the HandlerType of h, and returns the result.
It provides a compile-time guarantee that all types are handled, even if new HandlerType values are added in the future.
It panics if the function associated with h's type is nil.
func MapByHandlerTypeOfWithErr ¶ added in v0.16.2
func MapByHandlerTypeOfWithErr[T any]( h Handler, aggregate func(*Aggregate) (T, error), process func(*Process) (T, error), integration func(*Integration) (T, error), projection func(*Projection) (T, error), ) (result T, err error)
MapByHandlerTypeOfWithErr invokes one of the provided functions based on the HandlerType of h, and returns the result and error value.
It provides a compile-time guarantee that all types are handled, even if new HandlerType values are added in the future.
It panics if the function associated with h's type is nil.
func MapByRouteType ¶ added in v0.16.2
func MapByRouteType[T any]( t RouteType, handlesCommand T, handlesEvent T, executesCommand T, recordsEvent T, schedulesTimeout T, ) T
MapByRouteType maps t to a value of type T.
It provides a compile-time guarantee that all possible values are handled, even if new RouteType values are added in the future.
It panics if t is not a valid RouteType.
func RouteTypes ¶ added in v0.16.2
RouteTypes returns a list of all HandlerType values.
func SwitchByHandlerType ¶ added in v0.16.2
func SwitchByHandlerType( t HandlerType, aggregate func(), process func(), integration func(), projection func(), )
SwitchByHandlerType invokes one of the provided functions based on t.
It provides a compile-time guarantee that all possible values are handled, even if new HandlerType values are added in the future.
It panics if the function associated with t is nil, or if t is not a valid HandlerType.
func SwitchByHandlerTypeOf ¶ added in v0.16.2
func SwitchByHandlerTypeOf( h Handler, aggregate func(*Aggregate), process func(*Process), integration func(*Integration), projection func(*Projection), )
SwitchByHandlerTypeOf invokes one of the provided functions based on the HandlerType of h.
It provides a compile-time guarantee that all types are handled, even if new HandlerType values are added in the future.
It panics if the function associated with h's type is nil.
func SwitchByRouteType ¶ added in v0.16.2
func SwitchByRouteType( t RouteType, handlesCommand func(), handlesEvent func(), executesCommand func(), recordsEvent func(), schedulesTimeout func(), )
SwitchByRouteType invokes one of the provided functions based on t.
It provides a compile-time guarantee that all possible values are handled, even if new RouteType values are added in the future.
It panics if the function associated with t is nil, or if t is not a valid RouteType.
func Validate ¶ added in v0.16.2
func Validate(c Component, options ...ValidateOption) error
Validate returns an error if the configuration is invalid.
Types ¶
type Aggregate ¶ added in v0.16.2
type Aggregate struct {
HandlerCommon
Source optional.Optional[dogma.AggregateMessageHandler]
}
Aggregate is a Handler that represents the configuration of a dogma.AggregateMessageHandler.
func (*Aggregate) HandlerType ¶ added in v0.16.2
func (h *Aggregate) HandlerType() HandlerType
HandlerType returns the HandlerType of the handler.
func (*Aggregate) Identity ¶ added in v0.16.2
func (h *Aggregate) Identity() *identitypb.Identity
Identity returns the entity's identity.
It panics the configuration does not specify a singular valid identity.
func (*Aggregate) Interface ¶ added in v0.16.2
func (h *Aggregate) Interface() dogma.AggregateMessageHandler
Interface returns the dogma.Application that the entity represents.
func (*Aggregate) IsDisabled ¶ added in v0.16.2
IsDisabled returns true if the handler is disabled.
It panics if the configuration does not specify unambiguously whether the handler is enabled or disabled.
type AmbiguouslyIdentifiedEntityError ¶ added in v0.16.2
type AmbiguouslyIdentifiedEntityError struct {
Identities []*Identity
}
AmbiguouslyIdentifiedEntityError indicates that an Entity has been configured with more than one Identity.
func (AmbiguouslyIdentifiedEntityError) Error ¶ added in v0.16.2
func (e AmbiguouslyIdentifiedEntityError) Error() string
type Application ¶ added in v0.16.2
type Application struct {
EntityCommon
HandlerComponents []Handler
Source optional.Optional[dogma.Application]
}
Application is an Entity that represents the configuration of a dogma.Application.
func (*Application) HandlerByName ¶ added in v0.16.2
func (a *Application) HandlerByName(name string) (Handler, bool)
HandlerByName returns the Handler with the given name, or false if no such handler has been configured.
It panics if the handlers are incomplete or invalid.
func (*Application) Handlers ¶ added in v0.16.2
func (a *Application) Handlers() []Handler
Handlers returns the list of handlers configured for the application.
func (*Application) Identity ¶ added in v0.16.2
func (a *Application) Identity() *identitypb.Identity
Identity returns the entity's identity.
It panics the configuration does not specify a singular valid identity.
func (*Application) Interface ¶ added in v0.16.2
func (a *Application) Interface() dogma.Application
Interface returns the dogma.Application that the entity represents.
func (*Application) RouteSet ¶ added in v0.16.2
func (a *Application) RouteSet() RouteSet
RouteSet returns the routes configured for the entity.
It panics if the configuration does not specify a complete set of valid routes for the entity and its constituents.
func (*Application) String ¶ added in v0.16.2
func (a *Application) String() string
type Component ¶ added in v0.16.2
type Component interface {
fmt.Stringer
// ComponentProperties returns the properties common to all [Component]
// types.
ComponentProperties() *ComponentCommon
// contains filtered or unexported methods
}
Component is the "top-level" interface for the individual elements that form a complete configuration of a Dogma application or handler.
type ComponentCommon ¶ added in v0.16.2
type ComponentCommon struct {
// IsSpeculative indicates that the [Component] is only present in the
// configuration under certain conditions, and that those conditions could
// not be evaluated at configuration time.
IsSpeculative bool
// IsPartial indicates that the configuration could not be loaded in its
// entirety. The configuration may be valid, but cannot be safely used to
// execute an application.
//
// A value of false does not imply a complete configuration.
IsPartial bool
}
ComponentCommon contains the properties common to all Component types.
func (*ComponentCommon) ComponentProperties ¶ added in v0.16.2
func (p *ComponentCommon) ComponentProperties() *ComponentCommon
ComponentProperties returns the properties common to all Component types.
type ConcurrencyPreference ¶ added in v0.19.17
type ConcurrencyPreference struct {
ComponentCommon
// Value is the value itself, if known.
Value optional.Optional[dogma.ConcurrencyPreference]
}
A ConcurrencyPreference represents the configuration of handler's dogma.ConcurrencyPreference.
func (*ConcurrencyPreference) String ¶ added in v0.19.17
func (v *ConcurrencyPreference) String() string
type ConfigurationUnavailableError ¶ added in v0.16.2
type ConfigurationUnavailableError struct {
Description string
}
ConfigurationUnavailableError indicates that a Component's configuration is missing some information that is deemed necessary for the component to be considered valid.
func (ConfigurationUnavailableError) Error ¶ added in v0.16.2
func (e ConfigurationUnavailableError) Error() string
type DescribeOption ¶ added in v0.16.2
type DescribeOption func(*describeOptions)
DescribeOption changes the behavior of Describe.
func WithValidationResult ¶ added in v0.16.2
func WithValidationResult(err error) DescribeOption
WithValidationResult is a DescribeOption that sets the validation result to be included in the description.
type Disabled ¶ added in v0.16.2
type Disabled struct {
// contains filtered or unexported fields
}
Disabled is the Symbol for a Flag that indicates whether or not a Handler has been disabled.
type DuplicateRouteError ¶ added in v0.16.2
type DuplicateRouteError struct {
RouteType RouteType
MessageTypeName string
DuplicateRoutes []*Route
}
DuplicateRouteError indicates that a Handler is configured with multiple routes for the same message.Type.
func (DuplicateRouteError) Error ¶ added in v0.16.2
func (e DuplicateRouteError) Error() string
type Entity ¶ added in v0.16.2
type Entity interface {
Component
// Identity returns the entity's identity.
//
// It panics the configuration does not specify a singular valid identity.
Identity() *identitypb.Identity
// RouteSet returns the routes configured for the entity.
//
// It panics if the configuration does not specify a complete set of valid
// routes for the entity and its constituents.
RouteSet() RouteSet
// EntityProperties returns the properties common to all [Entity] types.
EntityProperties() *EntityCommon
}
An Entity is a Component that that represents the configuration of a Dogma entity, which is a type that implements one of the following interfaces:
- dogma.Application
- dogma.AggregateMessageHandler
- dogma.ProcessMessageHandler
- dogma.IntegrationMessageHandler
- dogma.ProjectionMessageHandler
See Handler for a more specific interface that represents the configuration of a Dogma handler.
type EntityCommon ¶ added in v0.16.2
type EntityCommon struct {
ComponentCommon
TypeName optional.Optional[string]
IdentityComponents []*Identity
}
EntityCommon contains the properties common to all Entity types.
func (*EntityCommon) EntityProperties ¶ added in v0.16.2
func (p *EntityCommon) EntityProperties() *EntityCommon
EntityProperties returns the properties common to all Entity types.
type Flag ¶ added in v0.16.2
type Flag[S Symbol] struct { ComponentCommon // Value is the boolean value to which the flag was set, if known. Value optional.Optional[bool] }
A Flag represents a change to some boolean state of a Component.
Each type of flag is uniquely identified by a Symbol.
type Handler ¶ added in v0.16.2
type Handler interface {
Entity
// HandlerType returns [HandlerType] of the handler.
HandlerType() HandlerType
// IsDisabled returns true if the handler is disabled.
//
// It panics if the configuration does not specify unambiguously whether the
// handler is enabled or disabled.
IsDisabled() bool
// HandlerProperties returns the properties common to all [Handler] types.
HandlerProperties() *HandlerCommon
}
A Handler is an Entity that represents the configuration of a Dogma handler.
type HandlerCommon ¶ added in v0.16.2
type HandlerCommon struct {
EntityCommon
RouteComponents []*Route
DisabledFlags []*Flag[Disabled]
}
HandlerCommon contains the properties common to all Handler types.
func (*HandlerCommon) HandlerProperties ¶ added in v0.16.2
func (p *HandlerCommon) HandlerProperties() *HandlerCommon
HandlerProperties returns the properties common to all Handler types.
type HandlerType ¶ added in v0.16.2
type HandlerType int
HandlerType is an enumeration of the types of message handlers.
const ( // AggregateHandlerType is the [HandlerType] for implementations of // [dogma.AggregateMessageHandler]. AggregateHandlerType HandlerType = iota // ProcessHandlerType is the [HandlerType] for implementations of // [dogma.ProcessMessageHandler]. ProcessHandlerType // IntegrationHandlerType is the [HandlerType] for implementations of // [dogma.IntegrationMessageHandler]. IntegrationHandlerType // ProjectionHandlerType is the [HandlerType] for implementations of // [dogma.ProjectionMessageHandler]. ProjectionHandlerType )
func (HandlerType) RouteCapabilities ¶ added in v0.16.2
func (t HandlerType) RouteCapabilities() RouteCapabilities
RouteCapabilities returns a value that describes the routing capabilities of the handler type.
func (HandlerType) String ¶ added in v0.16.2
func (t HandlerType) String() string
type Identity ¶ added in v0.16.2
type Identity struct {
ComponentCommon
// Name is the name element of the identity.
Name optional.Optional[string]
// Key is the key element of the identity.
Key optional.Optional[string]
}
Identity is a Component that that represents the unique identity of an Entity.
type IdentityKeyConflictError ¶ added in v0.16.2
IdentityKeyConflictError indicates that more than one [QEntity] within the same Application is shares the same "key" element of an Identity.
func (IdentityKeyConflictError) Error ¶ added in v0.16.2
func (e IdentityKeyConflictError) Error() string
type IdentityNameConflictError ¶ added in v0.16.2
IdentityNameConflictError indicates that more than one [QEntity] within the same Application is shares the same "name" element of an Identity.
func (IdentityNameConflictError) Error ¶ added in v0.16.2
func (e IdentityNameConflictError) Error() string
type Integration ¶ added in v0.16.2
type Integration struct {
HandlerCommon
Source optional.Optional[dogma.IntegrationMessageHandler]
ConcurrencyPreferences []*ConcurrencyPreference
}
Integration is a Handler that represents the configuration of a dogma.IntegrationMessageHandler.
func (*Integration) ConcurrencyPreference ¶ added in v0.19.17
func (h *Integration) ConcurrencyPreference() dogma.ConcurrencyPreference
ConcurrencyPreference returns the dogma.ConcurrencyPreference for the handler.
It panics if the configuration does not specify the preference unambiguously.
func (*Integration) HandlerType ¶ added in v0.16.2
func (h *Integration) HandlerType() HandlerType
HandlerType returns the HandlerType of the handler.
func (*Integration) Identity ¶ added in v0.16.2
func (h *Integration) Identity() *identitypb.Identity
Identity returns the entity's identity.
It panics the configuration does not specify a singular valid identity.
func (*Integration) Interface ¶ added in v0.16.2
func (h *Integration) Interface() dogma.IntegrationMessageHandler
Interface returns the dogma.Application that the entity represents.
func (*Integration) IsDisabled ¶ added in v0.16.2
func (h *Integration) IsDisabled() bool
IsDisabled returns true if the handler is disabled.
It panics if the configuration does not specify unambiguously whether the handler is enabled or disabled.
func (*Integration) RouteSet ¶ added in v0.16.2
func (h *Integration) RouteSet() RouteSet
RouteSet returns the routes configured for the entity.
It panics if the configuration does not specify a complete set of valid routes for the entity and its constituents.
func (*Integration) String ¶ added in v0.16.2
func (h *Integration) String() string
type InvalidComponentError ¶ added in v0.16.2
InvalidComponentError indicates that a Component is invalid.
func (InvalidComponentError) Error ¶ added in v0.16.2
func (e InvalidComponentError) Error() string
func (InvalidComponentError) Unwrap ¶ added in v0.16.2
func (e InvalidComponentError) Unwrap() []error
type InvalidIdentityKeyError ¶ added in v0.16.2
type InvalidIdentityKeyError struct {
InvalidKey string
}
InvalidIdentityKeyError indicates that the "key" element of an Identity is invalid.
func (InvalidIdentityKeyError) Error ¶ added in v0.16.2
func (e InvalidIdentityKeyError) Error() string
type InvalidIdentityNameError ¶ added in v0.16.2
type InvalidIdentityNameError struct {
InvalidName string
}
InvalidIdentityNameError indicates that the "name" element of an Identity is invalid.
func (InvalidIdentityNameError) Error ¶ added in v0.16.2
func (e InvalidIdentityNameError) Error() string
type MessageKindMismatchError ¶ added in v0.16.2
MessageKindMismatchError indicates that a Route refers to a message.Type that has a different message.Kind than the route's RouteType.
func (MessageKindMismatchError) Error ¶ added in v0.16.2
func (e MessageKindMismatchError) Error() string
type MissingRouteTypeError ¶ added in v0.16.2
type MissingRouteTypeError struct {
RouteType RouteType
}
MissingRouteTypeError indicates that a Handler is missing one of its required route types.
func (MissingRouteTypeError) Error ¶ added in v0.16.2
func (e MissingRouteTypeError) Error() string
type PartialConfigurationError ¶ added in v0.16.2
type PartialConfigurationError struct{}
PartialConfigurationError indicates that a Component's configuration could not be loaded in its entirety.
func (PartialConfigurationError) Error ¶ added in v0.16.2
func (e PartialConfigurationError) Error() string
type Process ¶ added in v0.16.2
type Process struct {
HandlerCommon
Source optional.Optional[dogma.ProcessMessageHandler]
}
Process is a Handler that represents the configuration of a dogma.ProcessMessageHandler.
func (*Process) HandlerType ¶ added in v0.16.2
func (h *Process) HandlerType() HandlerType
HandlerType returns the HandlerType of the handler.
func (*Process) Identity ¶ added in v0.16.2
func (h *Process) Identity() *identitypb.Identity
Identity returns the entity's identity.
It panics the configuration does not specify a singular valid identity.
func (*Process) Interface ¶ added in v0.16.2
func (h *Process) Interface() dogma.ProcessMessageHandler
Interface returns the dogma.Application that the entity represents.
func (*Process) IsDisabled ¶ added in v0.16.2
IsDisabled returns true if the handler is disabled.
It panics if the configuration does not specify unambiguously whether the handler is enabled or disabled.
type Projection ¶ added in v0.16.2
type Projection struct {
HandlerCommon
Source optional.Optional[dogma.ProjectionMessageHandler]
ConcurrencyPreferences []*ConcurrencyPreference
}
Projection is a Handler that represents the configuration of a dogma.ProjectionMessageHandler.
func (*Projection) ConcurrencyPreference ¶ added in v0.19.17
func (h *Projection) ConcurrencyPreference() dogma.ConcurrencyPreference
ConcurrencyPreference returns the dogma.ConcurrencyPreference for the handler.
It panics if the configuration does not specify the preference unambiguously.
func (*Projection) HandlerType ¶ added in v0.16.2
func (h *Projection) HandlerType() HandlerType
HandlerType returns the HandlerType of the handler.
func (*Projection) Identity ¶ added in v0.16.2
func (h *Projection) Identity() *identitypb.Identity
Identity returns the entity's identity.
It panics the configuration does not specify a singular valid identity.
func (*Projection) Interface ¶ added in v0.16.2
func (h *Projection) Interface() dogma.ProjectionMessageHandler
Interface returns the dogma.Application that the entity represents.
func (*Projection) IsDisabled ¶ added in v0.16.2
func (h *Projection) IsDisabled() bool
IsDisabled returns true if the handler is disabled.
It panics if the configuration does not specify unambiguously whether the handler is enabled or disabled.
func (*Projection) RouteSet ¶ added in v0.16.2
func (h *Projection) RouteSet() RouteSet
RouteSet returns the routes configured for the entity.
It panics if the configuration does not specify a complete set of valid routes for the entity and its constituents.
func (*Projection) String ¶ added in v0.16.2
func (h *Projection) String() string
type Route ¶ added in v0.16.2
type Route struct {
ComponentCommon
// RouteType is the type of route, if available.
RouteType optional.Optional[RouteType]
// TypeID is the unique identifier of the message type.
MessageTypeID optional.Optional[string]
// MessageTypeName is the fully-qualified name of the Go type that
// implements the [dogma.Message] interface, if available.
MessageTypeName optional.Optional[string]
// MessageType is the [message.Type], if available.
MessageType optional.Optional[message.Type]
}
Route represents the configuration of a dogma.Route.
type RouteCapabilities ¶ added in v0.16.2
type RouteCapabilities struct {
RouteTypes map[RouteType]RouteCapability
}
RouteCapabilities is a map that describes how a HandlerType makes use of each RouteType.
func (RouteCapabilities) DirectionOf ¶ added in v0.16.2
func (c RouteCapabilities) DirectionOf(k message.Kind) RouteDirection
DirectionOf returns the direction in which messages of the given kind flow for the HandlerType.
type RouteCapability ¶ added in v0.16.2
type RouteCapability int
RouteCapability is describes how a HandlerType makes use of a particular RouteType, if at all.
const ( // RouteTypeDisallowed indicates that the [HandlerType] does not support the // [RouteType]. RouteTypeDisallowed RouteCapability = iota // RouteTypeAllowed indicates that the [HandlerType] supports the // [RouteType], but it is not required. RouteTypeAllowed // RouteTypeRequired indicates that the [HandlerType] requires at least one // route of the [RouteType]. RouteTypeRequired )
type RouteConflictError ¶ added in v0.16.2
type RouteConflictError struct {
ConflictingRouteType RouteType
ConflictingMessageTypeName string
Handlers []Handler
}
RouteConflictError indicates that more than one Handler within the same Application is configured with routes for the same [MessageType] in a manner that is not permitted.
For example, no two handlers can handle commands of the same type, though any number of handlers may handle events of the same type.
func (RouteConflictError) Error ¶ added in v0.16.2
func (e RouteConflictError) Error() string
type RouteDirection ¶ added in v0.16.2
type RouteDirection int
RouteDirection is an bit-field of the "directions" in which a message flows for a specific RouteType.
const ( // InboundDirection is a [RouteDirection] that indicates a message flowing // into a handler. InboundDirection RouteDirection = 1 << iota // OutboundDirection is a [RouteDirection] that indicates a message flowing // out of a handler. OutboundDirection )
func (RouteDirection) Has ¶ added in v0.16.2
func (d RouteDirection) Has(x RouteDirection) bool
Has returns true if d is a superset of dir.
type RouteSet ¶ added in v0.16.2
type RouteSet struct {
// contains filtered or unexported fields
}
RouteSet is the set of routes configured for a specific Handler.
func (RouteSet) DirectionOf ¶ added in v0.16.2
func (s RouteSet) DirectionOf(t message.Type) RouteDirection
DirectionOf returns the direction in which messages of the given type flow for the Handler.
func (RouteSet) Filter ¶ added in v0.16.2
func (s RouteSet) Filter(filters ...RouteSetFilter) RouteSet
Filter returns a new RouteSet that contains only the routes that match all of the given filters.
func (RouteSet) HasMessageType ¶ added in v0.16.2
HasMessageType returns true if the RouteSet contains any routes for the given message type.
func (RouteSet) MessageTypeSet ¶ added in v0.19.1
MessageTypeSet returns a set of all of the message types in the RouteSet.
func (RouteSet) MessageTypes ¶ added in v0.16.2
func (s RouteSet) MessageTypes() map[message.Type]RouteDirection
MessageTypes returns a map all of the message types in the RouteSet and their respective RouteDirection.
type RouteSetFilter ¶ added in v0.16.2
type RouteSetFilter func(*routeSetFilters)
RouteSetFilter applies a filter to the routes within a RouteSet.
func FilterByMessageDirection ¶ added in v0.16.2
func FilterByMessageDirection(directions ...RouteDirection) RouteSetFilter
FilterByMessageDirection is a RouteSetFilter that limits results to routes for message types that have a RouteDirection that matches one of the given directions bit-masks, when considering all routes for that message type.
func FilterByMessageKind ¶ added in v0.16.2
func FilterByMessageKind(kinds ...message.Kind) RouteSetFilter
FilterByMessageKind is a RouteSetFilter that limits results to routes with a message.Kind that matches one of the given kinds.
func FilterByMessageType ¶ added in v0.16.2
func FilterByMessageType(kinds ...message.Kind) RouteSetFilter
FilterByMessageType is a RouteSetFilter that limits results to routes with a message.Type that matches one of the given types.
func FilterByRouteDirection ¶ added in v0.16.2
func FilterByRouteDirection(directions ...RouteDirection) RouteSetFilter
FilterByRouteDirection is a RouteSetFilter that limits results to routes with a RouteDirection that matches one of the given directions bit-masks.
func FilterByRouteType ¶ added in v0.16.2
func FilterByRouteType(types ...RouteType) RouteSetFilter
FilterByRouteType is a RouteSetFilter that limits results to routes with one of the given RouteType values.
type RouteType ¶ added in v0.16.2
type RouteType int
RouteType is an enumeration of the types of message routes that can be configured on a Handler.
const ( // HandlesCommandRouteType is a [RouteType] that indicates a [Handler] // handles a specific type of [dogma.Command] message. // // It is associated with routes configured by [dogma.HandlesCommand]. HandlesCommandRouteType RouteType = iota // HandlesEventRouteType is a [RouteType] that indicates a [Handler] handles // a specific type of [dogma.Event] message. // // It is associated with routes configured by [dogma.HandlesEvent]. HandlesEventRouteType // ExecutesCommandRouteType is a [RouteType] that indicates a [Handler] // executes a specific type of [dogma.Command] message. // // It is associated with routes configured by [dogma.ExecutesCommand]. ExecutesCommandRouteType // RecordsEventRouteType is a [RouteType] that indicates a [Handler] records // a specific type of [dogma.Event] message. // // It is associated with routes configured by [dogma.RecordsEvent]. RecordsEventRouteType // SchedulesTimeoutRouteType is a [RouteType] that indicates a [Handler] // schedules a specific type of [dogma.Timeout] message. // // It is associated with routes configured by [dogma.SchedulesTimeout]. SchedulesTimeoutRouteType )
func (RouteType) Direction ¶ added in v0.16.2
func (r RouteType) Direction() RouteDirection
Direction returns the direction in which messages flow for the route type.
func (RouteType) MessageKind ¶ added in v0.16.2
MessageKind returns the kind of message that the route type is associated with.
type SpeculativeConfigurationError ¶ added in v0.16.2
type SpeculativeConfigurationError struct{}
SpeculativeConfigurationError indicates that a Component's inclusion in the configuration is subject to some condition that could not be evaluated at the time the configuration was built.
func (SpeculativeConfigurationError) Error ¶ added in v0.16.2
func (e SpeculativeConfigurationError) Error() string
type Symbol ¶ added in v0.16.2
type Symbol interface {
~struct {
// contains filtered or unexported fields
}
}
A Symbol is a type that uniquely identifies a specific Flag.
type UnidentifiedEntityError ¶ added in v0.16.2
type UnidentifiedEntityError struct{}
UnidentifiedEntityError indicates that an Entity has been configured without an Identity.
func (UnidentifiedEntityError) Error ¶ added in v0.16.2
func (e UnidentifiedEntityError) Error() string
type UnrecognizedConcurrencyPreference ¶ added in v0.19.17
type UnrecognizedConcurrencyPreference struct {
InvalidValue dogma.ConcurrencyPreference
}
UnrecognizedConcurrencyPreference indicates that a handler's dogma.ConcurrencyPreference is invalid.
func (UnrecognizedConcurrencyPreference) Error ¶ added in v0.19.17
func (e UnrecognizedConcurrencyPreference) Error() string
type UnsupportedRouteTypeError ¶ added in v0.16.2
type UnsupportedRouteTypeError struct {
UnexpectedRoute *Route
}
UnsupportedRouteTypeError indicates that a Handler is configured with a Route of a RouteType that is not allowed for that handler type.
func (UnsupportedRouteTypeError) Error ¶ added in v0.16.2
func (e UnsupportedRouteTypeError) Error() string
type ValidateOption ¶ added in v0.16.2
type ValidateOption func(*validationOptions)
ValidateOption changes the behavior of [Component.Validate].
func ForExecution ¶ added in v0.16.2
func ForExecution() ValidateOption
ForExecution is a ValidateOption that requires all Entity and Route components to have full runtime type and value information available, such that the configuration can be used to execute an application on a Dogma engine.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
configbuilder
Package configbuilder provides utilities for building configuration components.
|
Package configbuilder provides utilities for building configuration components. |
|
constraints
Package constraints defines interfaces/constraints for the various interfaces defined in the Dogma package.
|
Package constraints defines interfaces/constraints for the various interfaces defined in the Dogma package. |
|
renderer
Package renderer provides utilities for rendering configuration.
|
Package renderer provides utilities for rendering configuration. |
|
Package runtimeconfig builds configuration from dogma.Application instances.
|
Package runtimeconfig builds configuration from dogma.Application instances. |