config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config parses and validates a declarative cascade configuration: a versioned YAML document that declares the input, the ordered stages and their gates, and where classified records are routed. It rejects a malformed pipeline up front, before any input is opened; building a runnable cascade from a Config belongs to the composition root (the CLI), not here.

Index

Constants

View Source
const Version = 1

Version is the only config schema version this build understands.

Variables

This section is empty.

Functions

func LoadMock

func LoadMock(path string) (*mockstage.Stage, error)

LoadMock builds a mock stage from a YAML file.

func LoadRules

func LoadRules(path string) (*rules.Stage, error)

LoadRules builds a rules stage from a YAML file.

func LoadSchema

func LoadSchema(path string) (*schema.Stage, error)

LoadSchema builds a schema stage from a YAML file.

func ParseMock

func ParseMock(data []byte) (*mockstage.Stage, error)

ParseMock builds a mock stage from a YAML document.

func ParseRules

func ParseRules(data []byte) (*rules.Stage, error)

ParseRules builds a rules stage from a YAML document.

func ParseSchema

func ParseSchema(data []byte) (*schema.Stage, error)

ParseSchema builds a schema stage from a YAML document.

Types

type Config

type Config struct {
	Version int                 `yaml:"version"`
	Input   Input               `yaml:"input"`
	Stages  []StageSpec         `yaml:"stages"`
	Workers int                 `yaml:"workers,omitempty"` // concurrent classification workers; 0/1 = serial
	Routes  map[string]SinkSpec `yaml:"routes,omitempty"`
	Sink    SinkSpec            `yaml:"sink"`
	Review  *SinkSpec           `yaml:"review,omitempty"`
}

Config is a declared cascade.

func Parse

func Parse(data []byte) (*Config, error)

Parse decodes a config from YAML, rejecting unknown keys, then validates it.

func (*Config) Validate

func (c *Config) Validate() error

Validate reports the first structural problem in the config, or nil.

type Input

type Input struct {
	Type string `yaml:"type"` // text | jsonl
}

Input names where records come from.

type SinkSpec

type SinkSpec struct {
	Type   string `yaml:"type"`             // jsonl | drop
	Path   string `yaml:"path,omitempty"`   // file path (jsonl)
	Stream string `yaml:"stream,omitempty"` // stdout (jsonl); stderr is diagnostics-only
}

SinkSpec is a place classified records are written.

type StageSpec

type StageSpec struct {
	ID   string   `yaml:"id"`
	Type string   `yaml:"type"`           // rules | schema | mock
	Path string   `yaml:"path,omitempty"` // type-specific config file
	Gate *float64 `yaml:"gate,omitempty"` // per-stage confidence gate in [0, 1]
}

StageSpec is one stage in the cascade.

Jump to

Keyboard shortcuts

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