validation

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionMode

type ExecutionMode string

ExecutionMode defines how validators are executed

const (
	// ModeSequential executes validators one after another
	ModeSequential ExecutionMode = "sequential"

	// ModeParallel executes validators concurrently
	ModeParallel ExecutionMode = "parallel"
)

type Pipeline

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

Pipeline implements the ValidationPipeline interface

func NewParallelPipeline

func NewParallelPipeline() *Pipeline

NewParallelPipeline creates a pipeline that executes validators in parallel

func NewPipeline

func NewPipeline(mode ExecutionMode) *Pipeline

NewPipeline creates a new validation pipeline

func NewSequentialPipeline

func NewSequentialPipeline() *Pipeline

NewSequentialPipeline creates a pipeline that executes validators sequentially

func (*Pipeline) AddValidator

func (p *Pipeline) AddValidator(validator interfaces.Validator) error

AddValidator adds a validator to the pipeline

func (*Pipeline) Execute

Execute runs all validators on the block

func (*Pipeline) ExecuteParallel

func (p *Pipeline) ExecuteParallel(ctx context.Context, block interfaces.Block) interfaces.ValidationResult

ExecuteParallel runs validators concurrently

func (*Pipeline) GetMetrics

func (p *Pipeline) GetMetrics() interfaces.ValidatorMetrics

GetMetrics returns pipeline metrics

func (*Pipeline) GetValidatorStats

func (p *Pipeline) GetValidatorStats(name string) (*ValidatorStats, error)

GetValidatorStats returns statistics for a specific validator

func (*Pipeline) GetValidators

func (p *Pipeline) GetValidators() []interfaces.Validator

GetValidators returns all validators in the pipeline

func (*Pipeline) RemoveValidator

func (p *Pipeline) RemoveValidator(name string) error

RemoveValidator removes a validator by name

func (*Pipeline) SetMode

func (p *Pipeline) SetMode(mode ExecutionMode)

SetMode sets the execution mode (sequential or parallel)

func (*Pipeline) SetStopOnFirstError

func (p *Pipeline) SetStopOnFirstError(stop bool)

SetStopOnFirstError sets whether to stop validation on first error

type PipelineMetrics

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

PipelineMetrics tracks validation pipeline statistics

func NewPipelineMetrics

func NewPipelineMetrics() *PipelineMetrics

NewPipelineMetrics creates new pipeline metrics

type ValidatorStats

type ValidatorStats struct {
	Executions    uint64
	Successes     uint64
	Failures      uint64
	TotalDuration time.Duration
	AvgDuration   time.Duration
}

ValidatorStats contains statistics for a specific validator

Jump to

Keyboard shortcuts

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