config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config provides configuration management for Gorilla DataFrame operations

Index

Constants

View Source
const (
	DefaultParallelThreshold   = 1000
	DefaultMaxParallelism      = 16
	DefaultGCPressureThreshold = 0.8
	DefaultAllocatorPoolSize   = 10

	// Performance tuning constants.
	SmallDatasetThreshold         = 100
	LargeDatasetThreshold         = 1000000
	LargeDatasetParallelThreshold = 500
	HighColumnCountThreshold      = 50
	LowColumnCountThreshold       = 5
	SmallChunkSize                = 100
	LargeChunkSize                = 2000
	WorkerPoolReductionFactor     = 2
)

Default configuration values.

Variables

This section is empty.

Functions

func SetGlobalConfig

func SetGlobalConfig(config Config)

SetGlobalConfig sets the global configuration.

Types

type Config

type Config struct {
	// Parallel Processing Configuration
	// Minimum rows to trigger parallel processing
	ParallelThreshold int `json:"parallel_threshold" yaml:"parallel_threshold"`
	// Number of worker goroutines (0 = auto-detect)
	WorkerPoolSize int `json:"worker_pool_size"   yaml:"worker_pool_size"`
	// Size of data chunks for parallel processing (0 = auto-calculate)
	ChunkSize      int `json:"chunk_size"         yaml:"chunk_size"`
	MaxParallelism int `json:"max_parallelism"    yaml:"max_parallelism"` // Maximum number of parallel operations

	// Memory Management Configuration
	// Memory threshold in bytes (0 = unlimited)
	MemoryThreshold int64 `json:"memory_threshold"      yaml:"memory_threshold"`
	// GC pressure threshold (0.0-1.0)
	GCPressureThreshold float64 `json:"gc_pressure_threshold" yaml:"gc_pressure_threshold"`
	AllocatorPoolSize   int     `json:"allocator_pool_size"   yaml:"allocator_pool_size"` // Size of allocator pool

	// Query Optimization Configuration
	FilterFusion      bool `json:"filter_fusion"      yaml:"filter_fusion"`      // Enable filter fusion optimization
	PredicatePushdown bool `json:"predicate_pushdown" yaml:"predicate_pushdown"` // Enable predicate pushdown optimization
	JoinOptimization  bool `json:"join_optimization"  yaml:"join_optimization"`  // Enable join optimization

	// Debugging Configuration
	EnableProfiling   bool `json:"enable_profiling"   yaml:"enable_profiling"`   // Enable performance profiling
	VerboseLogging    bool `json:"verbose_logging"    yaml:"verbose_logging"`    // Enable verbose logging
	MetricsCollection bool `json:"metrics_collection" yaml:"metrics_collection"` // Enable metrics collection
}

Config represents the global configuration for Gorilla DataFrame operations.

func GetGlobalConfig

func GetGlobalConfig() Config

GetGlobalConfig returns the current global configuration.

func LoadFromEnv

func LoadFromEnv() Config

LoadFromEnv loads configuration from environment variables.

func LoadFromFile

func LoadFromFile(filename string) (Config, error)

LoadFromFile loads configuration from a file (supports JSON, YAML).

func LoadFromJSON

func LoadFromJSON(data []byte) (Config, error)

LoadFromJSON loads configuration from JSON data.

func NewConfig

func NewConfig() Config

NewConfig creates a new configuration with default values.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration and returns an error if invalid.

func (*Config) WithDefaults

func (c *Config) WithDefaults() Config

WithDefaults returns a new configuration with default values filled in for zero values.

type OperationConfig

type OperationConfig struct {
	ForceParallel   bool  // Force parallel execution regardless of threshold
	DisableParallel bool  // Disable parallel execution
	CustomChunkSize int   // Custom chunk size for this operation
	MaxMemoryUsage  int64 // Maximum memory usage for this operation
}

OperationConfig represents per-operation configuration overrides.

type PerformanceTuner

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

PerformanceTuner provides dynamic performance tuning based on runtime conditions.

func NewPerformanceTuner

func NewPerformanceTuner(config *Config) *PerformanceTuner

NewPerformanceTuner creates a new performance tuner.

func (*PerformanceTuner) OptimizeForDataset

func (pt *PerformanceTuner) OptimizeForDataset(rowCount, columnCount int) Config

OptimizeForDataset optimizes configuration for a specific dataset.

type SystemInfo

type SystemInfo struct {
	CPUCount     int
	MemorySize   int64
	Architecture string
	OSType       string
}

SystemInfo contains system information for configuration validation.

func GetSystemInfo

func GetSystemInfo() SystemInfo

GetSystemInfo returns system information for configuration validation.

type Validator added in v0.3.1

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

Validator validates and provides recommendations for configuration.

func NewConfigValidator

func NewConfigValidator() *Validator

NewConfigValidator creates a new configuration validator. Deprecated: Use NewValidator instead.

func NewValidator added in v0.3.1

func NewValidator() *Validator

NewValidator creates a new configuration validator.

func (*Validator) Validate added in v0.3.1

func (cv *Validator) Validate(config Config) (Config, []string, error)

Validate validates a configuration and provides recommendations.

Jump to

Keyboard shortcuts

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