validation

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package validation provides dependency validation for CBT models

Package validation provides dependency validation for CBT models

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrModelNotFound          = errors.New("model not found")
	ErrDependencyNotFound     = errors.New("dependency model not found")
	ErrRangeNotAvailable      = errors.New("required range not available")
	ErrRangeNotCovered        = errors.New("range not fully covered")
	ErrNotTransformationModel = errors.New("model is not a transformation")
	ErrInvalidDependencyType  = errors.New("invalid dependency type")
	ErrInvalidModelType       = errors.New("invalid dependency model type")
	ErrFailedModelCast        = errors.New("failed to cast model to transformation")
)

Validation-specific errors

View Source
var (
	// ErrNotSQLModel is returned when external model is not a SQL model
	ErrNotSQLModel = errors.New("external model is not a SQL model")
)

Functions

This section is empty.

Types

type DependencyStatus

type DependencyStatus struct {
	ModelID   string
	Available bool
	MinPos    uint64
	MaxPos    uint64
	Error     error
}

DependencyStatus represents the status of a single dependency

type DependencyValidator

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

DependencyValidator implements the DependencyValidator interface

func NewDependencyValidator

func NewDependencyValidator(
	log *logrus.Logger,
	chClient clickhouse.ClientInterface,
	adminService *admin.Service,
	modelsService *models.Service,
) *DependencyValidator

NewDependencyValidator creates a new dependency validator

func (*DependencyValidator) GetInitialPosition

func (v *DependencyValidator) GetInitialPosition(ctx context.Context, modelID string) (uint64, error)

GetInitialPosition calculates the initial position for a model based on its dependencies Returns the earliest position where all dependencies have data available

func (*DependencyValidator) ValidateDependencies

func (v *DependencyValidator) ValidateDependencies(ctx context.Context, modelID string, position, interval uint64) (Result, error)

ValidateDependencies checks if all dependencies are satisfied for a model at a given position

type ExternalModelValidator

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

ExternalModelValidator implements the ExternalModelExecutor interface

func NewExternalModelExecutor

func NewExternalModelExecutor(log *logrus.Logger, chClient clickhouse.ClientInterface, adminService *admin.Service, modelsService *models.Service) *ExternalModelValidator

NewExternalModelExecutor creates a new external model executor The cacheManager can be nil if caching is not desired

func (*ExternalModelValidator) GetMinMax

func (e *ExternalModelValidator) GetMinMax(ctx context.Context, model models.External) (minPos, maxPos uint64, err error)

GetMinMax retrieves the min and max position values for an external model

type Result

type Result struct {
	CanProcess   bool
	Dependencies []DependencyStatus
	Errors       []error
}

Result contains the result of dependency validation

Jump to

Keyboard shortcuts

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