estimation

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package estimation defines a pluggable migration estimation calculator.

Each part of the calculation is encapsulated in one specific Calculator, and calculation results are aggregated by the Engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calculator

type Calculator interface {
	// Name returns the human-readable name of this calculator, used as the key in Engine results.
	Name() string
	// Keys returns the list of Param keys this calculator depends on.
	Keys() []string
	// Calculate runs the estimation using the provided params and returns an Estimation or an error.
	Calculate(params map[string]Param) (Estimation, error)
}

Calculator encapsulates one specific part of the estimation (e.g. "post migration troubleshooting", "storage migration").

type Engine

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

Engine orchestrates Calculator objects and aggregates their results

func NewEngine

func NewEngine() *Engine

NewEngine creates a new Engine with no calculators registered.

func (*Engine) Register

func (e *Engine) Register(c Calculator)

Register adds a Calculator to participate in the estimation. Calculators are executed in the order they are registered. Register panics if a calculator with the same Name() is already registered, as duplicate names would silently overwrite results in Run.

func (*Engine) Run

func (e *Engine) Run(inputs []Param) map[string]Estimation

Run executes all registered calculators against the provided params

type Estimation

type Estimation struct {
	Duration time.Duration
	Reason   string
}

Estimation the result of a Calculator calculation

type Param

type Param struct {
	Key   string      // Unique identifier (e.g., "network_bandwidth")
	Value interface{} // The actual value (e.g., 1000, "fast", 0.8)
}

Param represents an input for a Calculator (can be either user supplied or discovered)

Directories

Path Synopsis
Package calculators provides concrete Calculator implementations for the estimation engine.
Package calculators provides concrete Calculator implementations for the estimation engine.

Jump to

Keyboard shortcuts

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