Documentation
¶
Overview ¶
Package calculators provides concrete Calculator implementations for the estimation engine.
Each calculator estimates the time required for one specific phase of a VM migration (e.g. storage data transfer, post-migration troubleshooting). Calculators are designed to be composed via the estimation.Engine and accept input through estimation.Param slices.
Index ¶
Constants ¶
const ( // ParamVMCount total number of VMs in a cluster. ParamVMCount = "vm_count" // ParamTroubleshootMinsPerVM troubleshooting time in minutes per vm ParamTroubleshootMinsPerVM = "troubleshoot_mins_per_vm" // ParamPostMigrationEngineers number of engineers available to perform post-migration checks ParamPostMigrationEngineers = "post_migration_engineers" // ParamWorkHoursPerDay number of working hours per day available for post-migration checks ParamWorkHoursPerDay = "work_hours_per_day" DefaultTroubleshootMinsPerVM = 60.0 DefaultEngineerCount = 10 DefaultWorkHoursPerDay = 8.0 )
Param prefix = parameter keys in the params map given to the calculator Default prefix = default values for missing params and/or hardcoded assumptions
const ( // ParamTotalDiskGB is the estimation.Param key for the total disk size across all VMs in gigabytes. ParamTotalDiskGB = "total_disk_gb" // ParamTransferRateMbps is the estimation.Param key for the sustained network transfer rate in Mbps. ParamTransferRateMbps = "transfer_rate_mbps" // DefaultTransferRateMbps is the default transfer rate in Mbps (megabits per second). // 620 Mbps is equivalent to 77.6 MB/s, which matches the original 110 min/500 GB baseline. DefaultTransferRateMbps = 620.0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostMigrationTroubleShooting ¶
type PostMigrationTroubleShooting struct {
// contains filtered or unexported fields
}
PostMigrationTroubleShooting estimates time for post migration actions done by an engineers
func NewPostMigrationTroubleShooting ¶
func NewPostMigrationTroubleShooting(opts ...PostMigrationTroubleshootingOption) *PostMigrationTroubleShooting
NewPostMigrationTroubleShooting creates a PostMigrationTroubleShooting calculator with default settings that
can be overridden by Options
func (*PostMigrationTroubleShooting) Calculate ¶
func (c *PostMigrationTroubleShooting) Calculate(params map[string]estimation.Param) (estimation.Estimation, error)
Calculate estimates the post-migration troubleshooting duration based on VM count and engineer availability. ParamTroubleshootMinsPerVM, ParamPostMigrationEngineers, and ParamWorkHoursPerDay are optional and fall back to the struct defaults.
func (*PostMigrationTroubleShooting) Keys ¶
func (c *PostMigrationTroubleShooting) Keys() []string
Keys returns the list of parameter keys required by this calculator.
func (*PostMigrationTroubleShooting) Name ¶
func (c *PostMigrationTroubleShooting) Name() string
Name returns the human-readable name of this calculator.
type PostMigrationTroubleshootingOption ¶
type PostMigrationTroubleshootingOption func(*PostMigrationTroubleShooting)
PostMigrationTroubleshootingOption configuration option for the calculator
func WithEngineerCount ¶
func WithEngineerCount(count int) PostMigrationTroubleshootingOption
WithEngineerCount sets the number of engineers working in parallel during post-migration checks.
func WithTroubleshootMinsPerVM ¶
func WithTroubleshootMinsPerVM(mins float64) PostMigrationTroubleshootingOption
WithTroubleshootMinsPerVM sets the number of minutes spent troubleshooting each VM after migration.
func WithWorkHoursPerDay ¶
func WithWorkHoursPerDay(hours float64) PostMigrationTroubleshootingOption
WithWorkHoursPerDay sets the number of working hours per day used to derive the work-day count in the reason string.
type StorageMigration ¶
type StorageMigration struct {
// contains filtered or unexported fields
}
StorageMigration estimates the time required to transfer VM storage data from the source to the target cluster.
func NewStorageMigration ¶
func NewStorageMigration(opts ...StorageMigrationOption) *StorageMigration
NewStorageMigration creates a StorageMigration calculator with default settings. Optional StorageMigrationOption values can be supplied to override the defaults.
func (*StorageMigration) Calculate ¶
func (c *StorageMigration) Calculate(params map[string]estimation.Param) (estimation.Estimation, error)
Calculate estimates the storage migration duration based on total disk size and network transfer rate. Formula: (totalDiskGB * 1024) / (transferRateMbps / 8) / 60 transfer_rate_mbps is optional and falls back to the struct field default.
func (*StorageMigration) Keys ¶
func (c *StorageMigration) Keys() []string
Keys returns the list of parameter keys required by this calculator. transfer_rate_mbps is optional and falls back to the struct default.
func (*StorageMigration) Name ¶
func (c *StorageMigration) Name() string
Name returns the human-readable name of this calculator.
type StorageMigrationOption ¶
type StorageMigrationOption func(*StorageMigration)
StorageMigrationOption is a functional option for configuring a StorageMigration calculator.
func WithTransferRateMbps ¶
func WithTransferRateMbps(mbps float64) StorageMigrationOption
WithTransferRateMbps sets the sustained network transfer rate in Mbps used to estimate storage migration time. The value must be positive; non-positive values are ignored and the default is kept.