incremental

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: GPL-3.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package incremental provides the incremental transformation type handler

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIntervalRequired is returned when interval configuration is missing
	ErrIntervalRequired = errors.New("interval configuration is required")
	// ErrNoSchedulesConfig is returned when no schedules are configured
	ErrNoSchedulesConfig = errors.New("at least one schedule must be configured")
	// ErrDependenciesRequired is returned when dependencies are not specified
	ErrDependenciesRequired = errors.New("dependencies are required for incremental transformations")
	// ErrAdminServiceInvalid is returned when admin service doesn't implement required interface
	ErrAdminServiceInvalid = errors.New("admin service does not implement RecordCompletion")
	// ErrIntervalMaxRequired is returned when interval.max is not specified
	ErrIntervalMaxRequired = errors.New("interval.max is required")
	// ErrInvalidInterval is returned when interval.min exceeds interval.max
	ErrInvalidInterval = errors.New("interval.min cannot exceed interval.max")
	// ErrInvalidLimits is returned when min limit is greater than max limit
	ErrInvalidLimits = errors.New("min limit cannot be greater than max limit")
	// ErrIntervalTypeRequired is returned when interval.type is not specified
	ErrIntervalTypeRequired = errors.New("interval.type is required")
	// ErrInvalidFillDirection is returned when fill.direction is not 'head' or 'tail'
	ErrInvalidFillDirection = errors.New("fill.direction must be 'head' or 'tail'")
)

Functions

func Register

func Register()

Register registers the incremental handler with the global registry

Types

type Config

type Config struct {
	Type         transformation.Type         `yaml:"type"`
	Database     string                      `yaml:"database"`
	Table        string                      `yaml:"table"`
	Limits       *LimitsConfig               `yaml:"limits,omitempty"`
	Interval     *IntervalConfig             `yaml:"interval"`
	Schedules    *SchedulesConfig            `yaml:"schedules"`
	Fill         *FillConfig                 `yaml:"fill,omitempty"`
	Dependencies []transformation.Dependency `yaml:"dependencies"`
	Tags         []string                    `yaml:"tags,omitempty"`
	// Exec and Env are never read from this struct; they exist only so the strict
	// YAML decoder (KnownFields) accepts those keys. Consumption happens via
	// transformation.Config and transformation.Exec.
	Exec string            `yaml:"exec,omitempty"`
	Env  map[string]string `yaml:"env,omitempty"`

	// OriginalDependencies stores the dependencies before placeholder substitution
	OriginalDependencies []transformation.Dependency `yaml:"-"`
}

Config defines the configuration for incremental transformation models

type FillConfig added in v0.0.43

type FillConfig struct {
	Direction        string `yaml:"direction,omitempty"`          // "head" or "tail" (default: "head")
	AllowGapSkipping *bool  `yaml:"allow_gap_skipping,omitempty"` // default: true
	Buffer           uint64 `yaml:"buffer,omitempty"`             // Stay N positions behind dependency max (default: 0)
}

FillConfig defines how the transformation is initially filled and processed

func (*FillConfig) Validate added in v0.0.43

func (c *FillConfig) Validate() error

Validate checks if the fill configuration is valid

type Handler

type Handler struct {
	transformation.DependencyBase
	// contains filtered or unexported fields
}

Handler handles incremental transformation type operations

func NewHandler

func NewHandler(data []byte, adminTable transformation.AdminTable) (*Handler, error)

NewHandler creates a new handler for incremental transformations

func (*Handler) AllowGapSkipping added in v0.0.43

func (h *Handler) AllowGapSkipping() bool

AllowGapSkipping returns whether gap skipping is allowed during forward fill

func (*Handler) AllowsPartialIntervals

func (h *Handler) AllowsPartialIntervals() bool

AllowsPartialIntervals returns true if min interval is 0 (allows partial processing)

func (*Handler) ApplyOverrides added in v0.0.27

func (h *Handler) ApplyOverrides(override *transformation.Override)

ApplyOverrides applies configuration overrides to this incremental transformation handler.

func (*Handler) Config

func (h *Handler) Config() any

Config returns the typed configuration

func (*Handler) GetFillBuffer added in v0.0.43

func (h *Handler) GetFillBuffer() uint64

GetFillBuffer returns the configured fill buffer (how far behind dependencies to stay)

func (*Handler) GetFillDirection added in v0.0.43

func (h *Handler) GetFillDirection() string

GetFillDirection returns the configured fill direction ("head" or "tail")

func (*Handler) GetFlatDependencies

func (h *Handler) GetFlatDependencies() []string

GetFlatDependencies returns dependencies as string slice (API handler interface)

func (*Handler) GetInterval

func (h *Handler) GetInterval() (minInterval, maxInterval uint64)

GetInterval returns the min and max interval sizes (API handler interface)

func (*Handler) GetIntervalType

func (h *Handler) GetIntervalType() string

GetIntervalType returns the interval type for this incremental transformation

func (*Handler) GetLimits

func (h *Handler) GetLimits() *transformation.Limits

GetLimits returns the position limits configuration

func (*Handler) GetMaxInterval

func (h *Handler) GetMaxInterval() uint64

GetMaxInterval returns the maximum interval size

func (*Handler) GetMinInterval

func (h *Handler) GetMinInterval() uint64

GetMinInterval returns the minimum interval size

func (*Handler) GetSchedules

func (h *Handler) GetSchedules() (forwardfill, backfill string)

GetSchedules returns the forwardfill and backfill schedules (API handler interface)

func (*Handler) GetTemplateVariables

func (h *Handler) GetTemplateVariables(_ context.Context, taskInfo transformation.TaskInfo) map[string]any

GetTemplateVariables returns template variables for incremental transformations

func (*Handler) IsBackfillEnabled

func (h *Handler) IsBackfillEnabled() bool

IsBackfillEnabled returns true if backfill schedule is configured

func (*Handler) IsForwardFillEnabled

func (h *Handler) IsForwardFillEnabled() bool

IsForwardFillEnabled returns true if forward fill schedule is configured

func (*Handler) RecordCompletion

func (h *Handler) RecordCompletion(ctx context.Context, adminService any, modelID string, taskInfo transformation.TaskInfo) error

RecordCompletion records the completion of an incremental transformation

func (*Handler) RestoreConfig added in v0.1.0

func (h *Handler) RestoreConfig(snapshot any)

RestoreConfig restores overridable config values from a snapshot.

func (*Handler) ShouldTrackPosition

func (h *Handler) ShouldTrackPosition() bool

ShouldTrackPosition returns true for incremental transformations

func (*Handler) SnapshotConfig added in v0.1.0

func (h *Handler) SnapshotConfig() any

SnapshotConfig captures the current overridable config values.

func (*Handler) Type

func (h *Handler) Type() transformation.Type

Type returns the transformation type (incremental)

func (*Handler) Validate

func (h *Handler) Validate() error

Validate validates the configuration for incremental transformations

type IntervalConfig

type IntervalConfig struct {
	Max  uint64 `yaml:"max"`              // Maximum interval size for processing
	Min  uint64 `yaml:"min"`              // Minimum interval size (0 = allow any partial size)
	Type string `yaml:"type" json:"type"` // Required: examples: "second", "slot", "epoch", "block"
}

IntervalConfig defines interval configuration for transformations

func (*IntervalConfig) Validate

func (c *IntervalConfig) Validate() error

Validate checks if the interval configuration is valid

type LimitsConfig

type LimitsConfig struct {
	Min uint64 `yaml:"min,omitempty"`
	Max uint64 `yaml:"max,omitempty"`
}

LimitsConfig defines position limits for transformations

func (*LimitsConfig) Validate

func (c *LimitsConfig) Validate() error

Validate checks if the limits configuration is valid

type SchedulesConfig

type SchedulesConfig struct {
	ForwardFill string `yaml:"forwardfill,omitempty"` // Forward fill schedule (optional)
	Backfill    string `yaml:"backfill,omitempty"`    // Backfill schedule (optional)
}

SchedulesConfig defines scheduling configuration for transformations

func (*SchedulesConfig) Validate

func (c *SchedulesConfig) Validate() error

Validate checks if the schedules configuration is valid

type Snapshot added in v0.1.0

type Snapshot struct {
	IntervalMin uint64
	IntervalMax uint64
	ForwardFill string
	Backfill    string
	HasLimits   bool
	LimitsMin   uint64
	LimitsMax   uint64
	Tags        []string
}

Snapshot holds a point-in-time snapshot of overridable config fields.

func (*Snapshot) ToBaseConfigJSON added in v0.1.0

func (s *Snapshot) ToBaseConfigJSON() (json.RawMessage, error)

ToBaseConfigJSON serializes the snapshot to a JSON representation suitable for the management API's base_config response.

Jump to

Keyboard shortcuts

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