optimize

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAggregateSize  = 5 * 1024 * 1024 * 1024 // 5GB in bytes
	TargetSize        = 1 * 1024 * 1024 * 1024 // 1GB target size
	MinThreshold      = 1.0                    // Minimum AVS score to perform aggregation
	OperationCostBase = 0.1                    // Base cost per operation
)

Variables

This section is empty.

Functions

func Command

func Command() *cli.Command

Types

type AggregationOperation

type AggregationOperation struct {
	Files          []TarFile
	Score          float64
	FirstDatapoint uint64
	LastDatapoint  uint64
}

AggregationOperation represents a potential aggregation

type AggregationOptimizer

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

AggregationOptimizer handles the aggregation logic

func NewAggregationOptimizer

func NewAggregationOptimizer(files []TarFile) *AggregationOptimizer

NewAggregationOptimizer creates a new optimizer

func (*AggregationOptimizer) FindAllBeneficialAggregations

func (ao *AggregationOptimizer) FindAllBeneficialAggregations() []*AggregationOperation

FindAllBeneficialAggregations finds all aggregations above the threshold

func (*AggregationOptimizer) FindBestAggregation

func (ao *AggregationOptimizer) FindBestAggregation() *AggregationOperation

FindBestAggregation finds the optimal aggregation operation

func (*AggregationOptimizer) SetBalanceParameters

func (ao *AggregationOptimizer) SetBalanceParameters(minFilesForSmall int, maxSizeRatio int, allowMixedSizes bool)

SetBalanceParameters allows customizing balance validation parameters

func (*AggregationOptimizer) SetThresholds

func (ao *AggregationOptimizer) SetThresholds(minScore float64, targetSize int64, maxAggregateSize int64)

SetThresholds allows customizing optimization thresholds

type TarFile

type TarFile struct {
	ID      string
	Size    int64
	MinID   uint64 // Minimum datapoint ID in the file
	MaxID   uint64 // Maximum datapoint ID in the file
	S3Key   string
	Created time.Time
}

TarFile represents a tar file with metadata (adapted from client.DatarangeInfo)

func ConvertFromDatarangeInfo

func ConvertFromDatarangeInfo(dataranges []client.DatarangeInfo) []TarFile

ConvertFromDatarangeInfo converts client.DatarangeInfo to TarFile

Jump to

Keyboard shortcuts

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