Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type ErrorHandlingStrategy
- type FMesh
- func (fm *FMesh) ComponentByName(name string) *component.Component
- func (fm *FMesh) Components() *component.Collection
- func (fm *FMesh) IsDebug() bool
- func (fm *FMesh) LogDebug(v ...any)
- func (fm *FMesh) Logger() *log.Logger
- func (fm *FMesh) Run() (*RuntimeInfo, error)
- func (fm *FMesh) WithComponents(components ...*component.Component) *FMesh
- func (fm *FMesh) WithDescription(description string) *FMesh
- func (fm *FMesh) WithErr(err error) *FMesh
- type RuntimeInfo
Constants ¶
View Source
const ( // UnlimitedCycles defines the maximum number of activation cycles, 0 means no limit UnlimitedCycles = 0 // UnlimitedTime defines the maximum duration F-Mesh can run before being forcefully stopped, 0 means no limit UnlimitedTime = 0 )
Variables ¶
View Source
var ( // ErrHitAnErrorOrPanic is returned when f-mesh hit an error or panic and will be stopped ErrHitAnErrorOrPanic = errors.New("f-mesh hit an error or panic and will be stopped") // ErrHitAPanic is returned when f-mesh hit a panic and will be stopped ErrHitAPanic = errors.New("f-mesh hit a panic and will be stopped") // ErrUnsupportedErrorHandlingStrategy is returned when an unsupported error handling strategy is used ErrUnsupportedErrorHandlingStrategy = errors.New("unsupported error handling strategy") // ErrReachedMaxAllowedCycles is returned when the maximum number of allowed cycles is reached ErrReachedMaxAllowedCycles = errors.New("reached max allowed cycles") // ErrTimeLimitExceeded is returned when the time limit is exceeded ErrTimeLimitExceeded = errors.New("time limit exceeded") // ErrFailedToDrain is returned when failed to drain ErrFailedToDrain = errors.New("failed to drain") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ErrorHandlingStrategy defines how f-mesh will handle errors and panics
ErrorHandlingStrategy ErrorHandlingStrategy
// Debug enables debug mode, which logs additional detailed information for troubleshooting and analysis.
Debug bool
Logger *log.Logger
// CyclesLimit defines max number of activation cycles, 0 means no limit
CyclesLimit int
// TimeLimit defines the maximum duration F-Mesh can run before being forcefully stopped.
// A value of 0 disables the time constraint, allowing indefinite execution.
TimeLimit time.Duration
}
Config defines the configuration for the f-mesh
type ErrorHandlingStrategy ¶
type ErrorHandlingStrategy int
ErrorHandlingStrategy defines the strategy for handling errors in run-time
const ( // StopOnFirstErrorOrPanic stops the f-mesh on first error or panic StopOnFirstErrorOrPanic ErrorHandlingStrategy = iota // StopOnFirstPanic ignores errors, but stops the f-mesh on first panic StopOnFirstPanic // IgnoreAll allows to continue running the f-mesh regardless of how components finish their activation functions IgnoreAll )
type FMesh ¶
type FMesh struct {
common.NamedEntity
common.DescribedEntity
*common.Chainable
// contains filtered or unexported fields
}
FMesh is the functional mesh
func NewWithConfig ¶
NewWithConfig creates a new f-mesh with custom config
func (*FMesh) ComponentByName ¶
ComponentByName shortcut method
func (*FMesh) LogDebug ¶
LogDebug logs a debug message only when debug mode is enabled (no-op otherwise)
func (*FMesh) Run ¶
func (fm *FMesh) Run() (*RuntimeInfo, error)
Run starts the computation until there is no component which activates (mesh has no unprocessed inputs)
func (*FMesh) WithComponents ¶
WithComponents adds components to f-mesh
func (*FMesh) WithDescription ¶
WithDescription sets a description
Click to show internal directories.
Click to hide internal directories.