Documentation
¶
Overview ¶
Plik: flow/runner/config.go
Index ¶
- func FormatDuration(d time.Duration) string
- func JSONMapView(value any) any
- func PrintInfo(w io.Writer, path, _ string, meta map[string]any, ast core.Expr) int
- func Run(ctx context.Context, cfg Config, path string, payload map[string]any, ...) int
- func RunAssertions(w io.Writer, result any, durationMS int64, actions, asserts []string, ...) int
- func RunSource(ctx context.Context, cfg Config, src, name string, payload map[string]any, ...) int
- type Config
- type Execution
- type Observer
- type Opts
- type Record
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDuration ¶ added in v0.10.0
FormatDuration handles Windows clock resolution limits cleanly without misleading '0ns' outputs.
func JSONMapView ¶ added in v0.10.0
JSONMapView applies JSON tags to struct outputs before expr evaluation.
func PrintInfo ¶ added in v0.10.0
PrintInfo describes a .nflow file without executing it. It shows directives from meta, the sequence of atoms from the AST, and expected input.
func RunAssertions ¶
func RunAssertions(w io.Writer, result any, durationMS int64, actions, asserts []string, verbosity int) int
RunAssertions ewaluuje @assert: z meta plus CLI --assert.
Env dostępny dla asercji:
result — output ostatniej akcji w pipeline duration_ms — całkowity czas wykonania actions — lista nazw wykonanych akcji
Verbosity < 1 → cisza przy sukcesie.
func RunSource ¶ added in v0.10.0
func RunSource(ctx context.Context, cfg Config, src, name string, payload map[string]any, opts Opts) int
RunSource executes workflow DSL directly from in-memory text.
It is a thin wrapper over Execute: it handles --info, installs the observer, prints the result, and evaluates @assert: directives. Every other piece of orchestration lives in Execute so the same pipeline runs across cli, selftest, and embedded binaries.
Types ¶
type Config ¶ added in v0.10.0
type Config struct {
Resolver core.CapabilityResolver
Directives *core.DirectiveTable
Modifiers *core.ModifierTable
Operators *core.OperatorTable
Primaries *core.PrimaryExtensionTable
Materializers []core.Materializer
CompileOpts []core.CompileOption
// Hooks are applied to every resolver action and to the top-level
// program before execution. Callers that only want to see the
// result set this to nil.
Hooks []action.AnyHook
// EventSink, when non-nil, is wrapped by observe.Hook and appended
// to Hooks. Both paths end up on the execution-local resolver's
// actions; use either, or both.
EventSink observe.Sink
// MeasureAllocs wraps the compile and run phases of Execute with
// MemStats deltas so callers can attribute allocations to the
// compiler versus the runtime. ReadMemStats triggers a brief
// stop-the-world pause; leave false on production hot paths. This
// mirrors the same precedent as CompileDuration and RunDuration:
// Execute already reports per-phase diagnostics, and this is the
// allocation counterpart.
MeasureAllocs bool
}
Config bundles all compiler tables, capability resolvers, and materializers for a run. It is passed explicitly to prevent mutable package-level state.
type Execution ¶ added in v0.10.0
type Execution struct {
Output any
Meta map[string]any
CompileDuration time.Duration
RunDuration time.Duration
CompileAllocs uint64
CompileAllocBytes uint64
RunAllocs uint64
RunAllocBytes uint64
}
Execution is the outcome of one Execute call.
type Observer ¶ added in v0.10.0
type Observer struct {
// contains filtered or unexported fields
}
Observer tracks every action that passes through the runtime.