list

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

list/executor.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompiledRule

type CompiledRule struct {
	Name       string
	Priority   int
	Predicates []*schema.Predicate
	Effects    []*Effect
	FactPaths  []string
}

CompiledRule represents a rule after compilation

func (*CompiledRule) GetPriority

func (cr *CompiledRule) GetPriority() int

GetPriority implements the common.Prioritized interface

type Compiler

type Compiler struct{}

Compiler implements the Compiler interface for list-style rules

func (*Compiler) CompileFile

func (c *Compiler) CompileFile(path string, schemaInfo effectus.SchemaInfo) (effectus.Spec, error)

CompileFile compiles a rule file into a list-style spec

func (*Compiler) CompileParsedFile

func (c *Compiler) CompileParsedFile(file *ast.File, path string, schemaInfo effectus.SchemaInfo) (effectus.Spec, error)

CompileParsedFile compiles a parsed file into a list-style spec.

type Effect

type Effect struct {
	Verb string                 // Name of the verb
	Args map[string]interface{} // Arguments to the verb
}

Effect represents a verb to be executed along with its arguments This will be phased out in favor of effectus.Effect

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor is the main executor for list rules with saga and capability support

func NewExecutor

func NewExecutor(verbRegistry common.VerbRegistry, options ...ExecutorOption) *Executor

NewExecutor creates a new executor for list rules

func (*Executor) ExecuteRule

func (le *Executor) ExecuteRule(ctx context.Context, rule *CompiledRule, facts common.Facts) ([]eff.Effect, error)

ExecuteRule executes a single rule against facts with saga and capability support

type ExecutorOption

type ExecutorOption func(*Executor)

ExecutorOption defines an option for configuring the executor

func WithCapabilitySystem

func WithCapabilitySystem(capSystem *capability.CapabilitySystem) ExecutorOption

WithCapabilitySystem enables capability-based locking

func WithSaga

func WithSaga(store schema.SagaStore) ExecutorOption

WithSaga enables saga-style compensation for failed executions

type Spec

type Spec struct {
	Rules        []*CompiledRule
	FactPaths    []string
	Name         string
	SagaEnabled  bool                         // Whether to use saga execution
	SagaStore    schema.SagaStore             // Saga store for transaction management
	CapSystem    *capability.CapabilitySystem // Capability system for locking
	VerbRegistry common.VerbRegistry          // Verb registry for execution
}

Spec implements the effectus.Spec interface for list rules

func (*Spec) Execute

func (s *Spec) Execute(ctx context.Context, facts effectus.Facts, ex effectus.Executor) error

Execute runs all rules in the spec with saga and capability support

func (*Spec) GetName

func (s *Spec) GetName() string

GetName returns the name of this spec

func (*Spec) RequiredFacts

func (s *Spec) RequiredFacts() []string

RequiredFacts returns the list of fact paths required by this spec

Jump to

Keyboard shortcuts

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