engine

package
v0.0.47 Latest Latest
Warning

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

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

Documentation

Overview

Package engine provides the core CBT engine service

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRedisURLRequired is returned when Redis URL is not provided
	ErrRedisURLRequired = errors.New("redis URL is required")
	// ErrIntervalTypeEmpty is returned when an interval type has no transformations
	ErrIntervalTypeEmpty = errors.New("interval type must have at least one transformation")
	// ErrTransformationNameRequired is returned when a transformation has no name
	ErrTransformationNameRequired = errors.New("transformation name is required")
	// ErrInvalidTransformationFormat is returned when a transformation has an invalid format
	ErrInvalidTransformationFormat = errors.New("invalid transformation format")
	// ErrFrontendAddrRequired is returned when frontend is enabled but no address is configured
	ErrFrontendAddrRequired = errors.New("frontend address is required when frontend is enabled")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// Core settings
	Logging         string `yaml:"logging" default:"info" validate:"oneof=panic fatal warn info debug trace"`
	MetricsAddr     string `yaml:"metricsAddr" default:":9091"`
	HealthCheckAddr string `yaml:"healthCheckAddr"`
	PProfAddr       string `yaml:"pprofAddr"`

	// Dependencies
	ClickHouse clickhouse.Config `yaml:"clickhouse"`
	Redis      RedisConfig       `yaml:"redis"`

	// Coordinator specific
	Scheduler scheduler.Config `yaml:"scheduler"`

	// Worker specific settings
	Worker worker.Config `yaml:"worker"`

	// Models configuration
	Models models.Config `yaml:"models"`

	// Frontend service configuration (includes API)
	Frontend FrontendConfig `yaml:"frontend"`

	// Interval type transformations for API exposure
	IntervalTypes IntervalTypesConfig `yaml:"interval_types"`
}

Config represents the complete engine configuration

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type FrontendConfig added in v0.0.30

type FrontendConfig struct {
	Enabled bool   `yaml:"enabled" default:"false"`
	Addr    string `yaml:"addr" default:":8080" validate:"hostname_port"`
}

FrontendConfig represents frontend and API service configuration

func (*FrontendConfig) Validate added in v0.0.30

func (c *FrontendConfig) Validate() error

Validate validates the frontend configuration

type IntervalTypeTransformation added in v0.0.25

type IntervalTypeTransformation struct {
	Name       string `yaml:"name" json:"name"`                                 // Display name (e.g., "timestamp", "epoch")
	Expression string `yaml:"expression,omitempty" json:"expression,omitempty"` // Optional CEL expression (e.g., "math.floor(value / 12)")
	Format     string `yaml:"format,omitempty" json:"format,omitempty"`         // Optional display format hint (e.g., "datetime", "date", "time")
}

IntervalTypeTransformation represents a single transformation step for an interval type

type IntervalTypesConfig added in v0.0.25

type IntervalTypesConfig map[string][]IntervalTypeTransformation

IntervalTypesConfig maps interval type names to their transformation pipelines

func (IntervalTypesConfig) Validate added in v0.0.25

func (c IntervalTypesConfig) Validate() error

Validate validates the interval types configuration

type RedisConfig

type RedisConfig struct {
	URL string `yaml:"url" validate:"required,url"`
}

RedisConfig represents Redis connection configuration

type Service

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

Service encapsulates the worker application logic

func NewService

func NewService(log *logrus.Logger, cfg *Config) (*Service, error)

NewService creates a new worker application

func (*Service) Start

func (a *Service) Start() error

Start initializes and starts the worker application

func (*Service) Stop

func (a *Service) Stop() error

Stop gracefully shuts down the worker application

Jump to

Keyboard shortcuts

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