Documentation
¶
Index ¶
- type AccessPattern
- type AccessPredictor
- type AdvancedLoadBalancer
- func (lb *AdvancedLoadBalancer) AddTarget(target *LoadBalanceTarget) error
- func (lb *AdvancedLoadBalancer) GetMetrics() *LoadBalancerMetrics
- func (lb *AdvancedLoadBalancer) RecordRequest(targetID string, latency time.Duration, success bool)
- func (lb *AdvancedLoadBalancer) RemoveTarget(targetID string) error
- func (lb *AdvancedLoadBalancer) SelectTarget(request *BalanceRequest) (*LoadBalanceTarget, error)
- func (lb *AdvancedLoadBalancer) Start() error
- func (lb *AdvancedLoadBalancer) Stop() error
- type Alert
- type AlertChannel
- type AlertCondition
- type AlertConfig
- type AlertManager
- type AlertMessage
- type AlertMetrics
- type AlertRule
- type AnalyzerConfig
- type AnalyzerMetrics
- type ApplicationMetrics
- type AutoScaler
- type AutoScalingConfig
- type BalanceRequest
- type BalanceTarget
- type BalancerConfig
- type BalancerMetrics
- type BalancingStrategy
- type Benchmark
- type BenchmarkConfig
- type BenchmarkFunction
- type BenchmarkResult
- type BlockProfiler
- type ByteSliceFactory
- type ByteSliceReset
- type CPUMetrics
- type CPUProfiler
- type CacheEntry
- type CacheInvalidator
- type CacheInvalidatorConfig
- type CacheMetrics
- type CachePartition
- type CachePartitioner
- type CachePartitionerConfig
- type CacheSchedulerMetrics
- type CacheWarmer
- type CacheWarmerConfig
- type CircuitBreaker
- type CircuitBreakerConfig
- type CircuitBreakerMetrics
- type CircuitBreakerSettings
- type CircuitState
- type ClientPermissions
- type ConcurrencyEngine
- func (e *ConcurrencyEngine) CreatePipeline(config PipelineConfig, stages []StageProcessor) (*ExecutionPipeline, error)
- func (e *ConcurrencyEngine) CreateWorkerPool(config WorkerPoolConfig, processor TaskProcessor) (*WorkerPool, error)
- func (e *ConcurrencyEngine) GetMetrics() *ConcurrencyMetrics
- func (e *ConcurrencyEngine) Start() error
- func (e *ConcurrencyEngine) Stop() error
- func (e *ConcurrencyEngine) SubmitTask(task Task) error
- func (e *ConcurrencyEngine) SubmitTasks(tasks []Task) error
- type ConcurrencyEngineConfig
- type ConcurrencyMetrics
- type ConsistentHashRing
- type CoordinationMode
- type CoordinatorConfig
- type CoordinatorMetrics
- type DashboardClient
- type DashboardConfig
- type DashboardMetrics
- type DataPoint
- type DefaultLogger
- type DiskMetrics
- type DistributedRateLimitConfig
- type DistributedRateLimiter
- func (d *DistributedRateLimiter) Allow(request *RateLimitRequest) (*RateLimitResult, error)
- func (d *DistributedRateLimiter) AllowN(key string, n int64) (*RateLimitResult, error)
- func (d *DistributedRateLimiter) GetMetrics() *RateLimitMetrics
- func (d *DistributedRateLimiter) GetStatus(key string) (*RateLimitResult, error)
- func (d *DistributedRateLimiter) Reset(key string) error
- func (d *DistributedRateLimiter) Start() error
- func (d *DistributedRateLimiter) Stop() error
- type ExecutionPipeline
- type ExecutorMetrics
- type GCMetrics
- type GCStats
- type GoroutineMetrics
- type GoroutineProfiler
- type HealthCheck
- type HealthCheckType
- type HealthChecker
- type HealthMetrics
- type HealthMonitor
- type HealthMonitorConfig
- type HeartbeatManager
- type Hotspot
- type InvalidationCallback
- type InvalidationHandler
- type InvalidationStrategy
- type InvalidatorMetrics
- type IssueType
- type KeyRange
- type LoadBalanceTarget
- type LoadBalancer
- type LoadBalancerConfig
- type LoadBalancerDataPoint
- type LoadBalancerMetrics
- type LoadDataPoint
- type LoadForecast
- type LoadHistory
- type LoadPredictionConfig
- type LoadPredictor
- type Logger
- type MapFactory
- type MapReset
- type MemoryMetrics
- type MemoryPoolConfig
- type MemoryPoolManager
- func (m *MemoryPoolManager) CreatePool(name string, factory ObjectFactory, reset ObjectReset) (*ObjectPool, error)
- func (m *MemoryPoolManager) Get(poolName string) (interface{}, error)
- func (m *MemoryPoolManager) GetMetrics() *MemoryPoolMetrics
- func (m *MemoryPoolManager) GetPool(name string) (*ObjectPool, error)
- func (m *MemoryPoolManager) GetPoolMetrics() []*ObjectPoolMetrics
- func (m *MemoryPoolManager) Put(poolName string, obj interface{}) error
- func (m *MemoryPoolManager) Start() error
- func (m *MemoryPoolManager) Stop() error
- type MemoryPoolMetrics
- type MemoryProfiler
- type MetricsCollector
- type MetricsMessage
- type MonitoringDashboard
- func (d *MonitoringDashboard) AddMetricsCollector(collector MetricsCollector)
- func (d *MonitoringDashboard) BroadcastAlert(alert AlertMessage)
- func (d *MonitoringDashboard) GetMetrics() *DashboardMetrics
- func (d *MonitoringDashboard) RemoveMetricsCollector(name string)
- func (d *MonitoringDashboard) Start() error
- func (d *MonitoringDashboard) Stop() error
- type MutexProfiler
- type NetworkMetrics
- type NodeInfo
- type NodeLoad
- type NodeStatus
- type ObjectFactory
- type ObjectPool
- type ObjectPoolMetrics
- type ObjectReset
- type OptimizationResult
- type OptimizationStrategy
- type OptimizerConfig
- type OptimizerMetrics
- type PartitionHealth
- type PartitionMetrics
- type PartitionStrategy
- type PartitionerMetrics
- type PerformanceAnalyzer
- type PerformanceIssue
- type PerformanceMetrics
- type PerformanceOptimizer
- type PerformanceProfiler
- func (p *PerformanceProfiler) CollectMetrics() *PerformanceMetrics
- func (p *PerformanceProfiler) GenerateReport(period ReportPeriod) (*PerformanceReport, error)
- func (p *PerformanceProfiler) GetMetrics() *ProfilerMetrics
- func (p *PerformanceProfiler) Start() error
- func (p *PerformanceProfiler) Stop() error
- type PerformanceReport
- type PerformanceReporter
- type PerformanceSummary
- type PerformanceThresholds
- type PipelineConfig
- type PipelineMetrics
- type PipelineResult
- type PipelineStage
- type PoolMetrics
- type PooledObject
- type PredictionAlgorithm
- type PredictionMetrics
- type PredictionModel
- type PredictionPoint
- type PredictorConfig
- type PriorityQueue
- type ProfileData
- type Profiler
- func NewBlockProfiler(dir string, logger Logger) Profiler
- func NewCPUProfiler(dir string, logger Logger) Profiler
- func NewGoroutineProfiler(dir string, logger Logger) Profiler
- func NewMemoryProfiler(dir string, logger Logger) Profiler
- func NewMutexProfiler(dir string, logger Logger) Profiler
- func NewTraceProfiler(dir string, logger Logger) Profiler
- type ProfilerConfig
- type ProfilerMetrics
- type RateLimitAlgorithm
- type RateLimitMetrics
- type RateLimitRequest
- type RateLimitResult
- type RateLimitScripts
- type ReadPreference
- type RedisClusterCache
- func (c *RedisClusterCache) Delete(key string) error
- func (c *RedisClusterCache) Get(key string) (interface{}, error)
- func (c *RedisClusterCache) GetMetrics() *CacheMetrics
- func (c *RedisClusterCache) InvalidateByTags(tags []string) error
- func (c *RedisClusterCache) Set(key string, value interface{}, ttl time.Duration, tags ...string) error
- func (c *RedisClusterCache) Start() error
- func (c *RedisClusterCache) Stop() error
- type RedisClusterCacheConfig
- type ReportExporter
- type ReportPeriod
- type ReportTemplate
- type ReporterConfig
- type ReporterMetrics
- type ResourceStats
- type ScalingCondition
- type ScalingEvent
- type ScalingHistory
- type ScalingMetrics
- type ScalingPolicy
- type ScalingTrigger
- type ScalingType
- type SchedulerConfig
- type SchedulerMetrics
- type SchedulingAlgorithm
- type ServiceDiscovery
- type Severity
- type StageMetrics
- type StageProcessor
- type StageWorker
- type StringBuilderFactory
- type StringBuilderReset
- type TagIndex
- type TargetHealthStatus
- type TargetStatistics
- type Task
- type TaskProcessor
- type TaskScheduler
- type ThresholdOperator
- type TraceProfiler
- type Trend
- type TrendAnalysis
- type TrendDirection
- type WarmerMetrics
- type WarmingExecutor
- type WarmingJob
- type WarmingScheduler
- type WarmingStrategy
- type WarmingWorker
- type WeightAlgorithm
- type WeightConfig
- type Worker
- type WorkerCoordinator
- type WorkerMetrics
- type WorkerPool
- type WorkerPoolConfig
- type WorkerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessPattern ¶ added in v0.2.0
type AccessPredictor ¶ added in v0.2.0
type AccessPredictor struct {
// contains filtered or unexported fields
}
func (*AccessPredictor) RecordAccess ¶ added in v0.2.0
func (ap *AccessPredictor) RecordAccess(key string)
type AdvancedLoadBalancer ¶ added in v0.2.0
type AdvancedLoadBalancer struct {
// contains filtered or unexported fields
}
AdvancedLoadBalancer provides sophisticated load balancing and auto-scaling
func NewAdvancedLoadBalancer ¶ added in v0.2.0
func NewAdvancedLoadBalancer(config LoadBalancerConfig, logger Logger) *AdvancedLoadBalancer
NewAdvancedLoadBalancer creates a new advanced load balancer
func (*AdvancedLoadBalancer) AddTarget ¶ added in v0.2.0
func (lb *AdvancedLoadBalancer) AddTarget(target *LoadBalanceTarget) error
AddTarget adds a new target
func (*AdvancedLoadBalancer) GetMetrics ¶ added in v0.2.0
func (lb *AdvancedLoadBalancer) GetMetrics() *LoadBalancerMetrics
GetMetrics returns load balancer metrics
func (*AdvancedLoadBalancer) RecordRequest ¶ added in v0.2.0
func (lb *AdvancedLoadBalancer) RecordRequest(targetID string, latency time.Duration, success bool)
RecordRequest records the result of a request
func (*AdvancedLoadBalancer) RemoveTarget ¶ added in v0.2.0
func (lb *AdvancedLoadBalancer) RemoveTarget(targetID string) error
RemoveTarget removes a target
func (*AdvancedLoadBalancer) SelectTarget ¶ added in v0.2.0
func (lb *AdvancedLoadBalancer) SelectTarget(request *BalanceRequest) (*LoadBalanceTarget, error)
SelectTarget selects the best target based on the configured strategy
func (*AdvancedLoadBalancer) Start ¶ added in v0.2.0
func (lb *AdvancedLoadBalancer) Start() error
Start starts the load balancer
func (*AdvancedLoadBalancer) Stop ¶ added in v0.2.0
func (lb *AdvancedLoadBalancer) Stop() error
Stop stops the load balancer
type Alert ¶
type Alert struct {
ID string `json:"id"`
Rule string `json:"rule"`
Severity Severity `json:"severity"`
Title string `json:"title"`
Message string `json:"message"`
Value float64 `json:"value"`
Threshold float64 `json:"threshold"`
Timestamp time.Time `json:"timestamp"`
Resolved bool `json:"resolved"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
Metadata map[string]interface{} `json:"metadata"`
}
type AlertChannel ¶ added in v0.2.0
type AlertCondition ¶ added in v0.2.0
type AlertCondition string
const ( AlertConditionGreaterThan AlertCondition = "greater_than" AlertConditionLessThan AlertCondition = "less_than" AlertConditionEquals AlertCondition = "equals" AlertConditionChange AlertCondition = "change" )
type AlertConfig ¶ added in v0.2.0
type AlertManager ¶ added in v0.2.0
type AlertManager struct {
// contains filtered or unexported fields
}
Alert management
func NewAlertManager ¶ added in v0.2.0
func NewAlertManager(config AlertConfig, logger Logger) *AlertManager
func (*AlertManager) CheckAlerts ¶ added in v0.2.0
func (am *AlertManager) CheckAlerts(metrics *PerformanceMetrics)
func (*AlertManager) GetActiveAlerts ¶ added in v0.2.0
func (am *AlertManager) GetActiveAlerts() []*Alert
func (*AlertManager) Start ¶ added in v0.2.0
func (am *AlertManager) Start() error
func (*AlertManager) Stop ¶ added in v0.2.0
func (am *AlertManager) Stop() error
type AlertMessage ¶ added in v0.2.0
type AlertMessage struct {
Type string `json:"type"`
Timestamp time.Time `json:"timestamp"`
Severity string `json:"severity"`
Title string `json:"title"`
Message string `json:"message"`
Source string `json:"source"`
Metadata map[string]interface{} `json:"metadata"`
}
AlertMessage represents a real-time alert
type AlertMetrics ¶ added in v0.2.0
type AnalyzerConfig ¶ added in v0.2.0
type AnalyzerMetrics ¶ added in v0.2.0
type ApplicationMetrics ¶ added in v0.2.0
type ApplicationMetrics struct {
RequestsPerSecond float64 `json:"requests_per_second"`
AverageLatency time.Duration `json:"average_latency"`
P95Latency time.Duration `json:"p95_latency"`
P99Latency time.Duration `json:"p99_latency"`
ErrorRate float64 `json:"error_rate"`
ActiveConnections int `json:"active_connections"`
QueueDepth int `json:"queue_depth"`
}
type AutoScaler ¶
type AutoScaler struct {
// contains filtered or unexported fields
}
AutoScaler handles automatic scaling of targets
func NewAutoScaler ¶
func NewAutoScaler(config AutoScalingConfig, logger Logger) *AutoScaler
func (*AutoScaler) Start ¶
func (as *AutoScaler) Start() error
func (*AutoScaler) Stop ¶
func (as *AutoScaler) Stop() error
type AutoScalingConfig ¶ added in v0.2.0
type AutoScalingConfig struct {
Enabled bool `json:"enabled"`
MinTargets int `json:"min_targets"`
MaxTargets int `json:"max_targets"`
ScaleUpThreshold float64 `json:"scale_up_threshold"`
ScaleDownThreshold float64 `json:"scale_down_threshold"`
ScaleUpCooldown time.Duration `json:"scale_up_cooldown"`
ScaleDownCooldown time.Duration `json:"scale_down_cooldown"`
EvaluationInterval time.Duration `json:"evaluation_interval"`
PredictiveScaling bool `json:"predictive_scaling"`
ScalingPolicies []ScalingPolicy `json:"scaling_policies"`
}
AutoScalingConfig defines auto-scaling configuration
type BalanceRequest ¶ added in v0.2.0
type BalanceRequest struct {
Key string `json:"key"`
Strategy string `json:"strategy"`
Preferences map[string]interface{} `json:"preferences"`
Metadata map[string]string `json:"metadata"`
}
BalanceRequest represents a load balancing request
type BalanceTarget ¶ added in v0.2.0
type BalancerConfig ¶ added in v0.2.0
type BalancerMetrics ¶ added in v0.2.0
type BalancingStrategy ¶ added in v0.2.0
type BalancingStrategy string
BalancingStrategy defines load balancing strategies
const ( BalancingRoundRobin BalancingStrategy = "round_robin" BalancingLeastActive BalancingStrategy = "least_active" BalancingWeighted BalancingStrategy = "weighted" BalancingConsistent BalancingStrategy = "consistent_hash" BalancingAdaptive BalancingStrategy = "adaptive" )
type Benchmark ¶ added in v0.2.0
type Benchmark struct {
Name string `json:"name"`
Description string `json:"description"`
Function BenchmarkFunction `json:"-"`
Results []*BenchmarkResult `json:"results"`
Config BenchmarkConfig `json:"config"`
Enabled bool `json:"enabled"`
}
Benchmark management
type BenchmarkConfig ¶ added in v0.2.0
type BenchmarkFunction ¶ added in v0.2.0
type BenchmarkFunction func() BenchmarkResult
type BenchmarkResult ¶ added in v0.2.0
type BenchmarkResult struct {
Timestamp time.Time `json:"timestamp"`
Duration time.Duration `json:"duration"`
Iterations int `json:"iterations"`
NsPerOp int64 `json:"ns_per_op"`
AllocsPerOp int64 `json:"allocs_per_op"`
BytesPerOp int64 `json:"bytes_per_op"`
MemoryUsed int64 `json:"memory_used"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
type BlockProfiler ¶ added in v0.2.0
type BlockProfiler struct {
// contains filtered or unexported fields
}
func (*BlockProfiler) Collect ¶ added in v0.2.0
func (bp *BlockProfiler) Collect() (*ProfileData, error)
func (*BlockProfiler) GetName ¶ added in v0.2.0
func (bp *BlockProfiler) GetName() string
func (*BlockProfiler) IsEnabled ¶ added in v0.2.0
func (bp *BlockProfiler) IsEnabled() bool
func (*BlockProfiler) Start ¶ added in v0.2.0
func (bp *BlockProfiler) Start() error
func (*BlockProfiler) Stop ¶ added in v0.2.0
func (bp *BlockProfiler) Stop() error
type ByteSliceFactory ¶ added in v0.2.0
type ByteSliceFactory struct {
Size int
}
ByteSliceFactory creates byte slice pools
func NewByteSliceFactory ¶ added in v0.2.0
func NewByteSliceFactory(size int) *ByteSliceFactory
func (*ByteSliceFactory) CreateObject ¶ added in v0.2.0
func (f *ByteSliceFactory) CreateObject() interface{}
func (*ByteSliceFactory) GetObjectType ¶ added in v0.2.0
func (f *ByteSliceFactory) GetObjectType() string
type ByteSliceReset ¶ added in v0.2.0
type ByteSliceReset struct{}
ByteSliceReset resets byte slices
func (*ByteSliceReset) ResetObject ¶ added in v0.2.0
func (r *ByteSliceReset) ResetObject(obj interface{}) error
type CPUMetrics ¶ added in v0.2.0
type CPUMetrics struct {
Usage float64 `json:"usage"`
UserTime time.Duration `json:"user_time"`
SystemTime time.Duration `json:"system_time"`
IdleTime time.Duration `json:"idle_time"`
LoadAverage []float64 `json:"load_average"`
}
Various metrics structures
type CPUProfiler ¶ added in v0.2.0
type CPUProfiler struct {
// contains filtered or unexported fields
}
Individual profiler structs
func (*CPUProfiler) Collect ¶ added in v0.2.0
func (cp *CPUProfiler) Collect() (*ProfileData, error)
func (*CPUProfiler) GetName ¶ added in v0.2.0
func (cp *CPUProfiler) GetName() string
func (*CPUProfiler) IsEnabled ¶ added in v0.2.0
func (cp *CPUProfiler) IsEnabled() bool
func (*CPUProfiler) Start ¶ added in v0.2.0
func (cp *CPUProfiler) Start() error
func (*CPUProfiler) Stop ¶ added in v0.2.0
func (cp *CPUProfiler) Stop() error
type CacheEntry ¶
type CacheEntry struct {
Key string `json:"key"`
Value interface{} `json:"value"`
TTL time.Duration `json:"ttl"`
CreatedAt time.Time `json:"created_at"`
AccessedAt time.Time `json:"accessed_at"`
AccessCount int64 `json:"access_count"`
Tags []string `json:"tags"`
Metadata map[string]interface{} `json:"metadata"`
Compressed bool `json:"compressed"`
Size int64 `json:"size"`
}
CacheEntry represents a cache entry with metadata
type CacheInvalidator ¶ added in v0.2.0
type CacheInvalidator struct {
// contains filtered or unexported fields
}
CacheInvalidator handles cache invalidation
func NewCacheInvalidator ¶ added in v0.2.0
func NewCacheInvalidator(config CacheInvalidatorConfig, logger Logger) *CacheInvalidator
func (*CacheInvalidator) InvalidateByTags ¶ added in v0.2.0
func (ci *CacheInvalidator) InvalidateByTags(tags []string) error
func (*CacheInvalidator) Start ¶ added in v0.2.0
func (ci *CacheInvalidator) Start() error
func (*CacheInvalidator) Stop ¶ added in v0.2.0
func (ci *CacheInvalidator) Stop() error
type CacheInvalidatorConfig ¶ added in v0.2.0
type CacheInvalidatorConfig struct {
Strategies []InvalidationStrategy `json:"strategies"`
TTLCheckInterval time.Duration `json:"ttl_check_interval"`
MaxTagsPerKey int `json:"max_tags_per_key"`
BatchSize int `json:"batch_size"`
}
type CacheMetrics ¶
type CacheMetrics struct {
Hits int64 `json:"hits"`
Misses int64 `json:"misses"`
Sets int64 `json:"sets"`
Deletes int64 `json:"deletes"`
Evictions int64 `json:"evictions"`
HitRatio float64 `json:"hit_ratio"`
AverageLatency time.Duration `json:"average_latency"`
TotalKeys int64 `json:"total_keys"`
TotalSize int64 `json:"total_size"`
PartitionMetrics []*PartitionMetrics `json:"partition_metrics"`
}
Various metrics structures
type CachePartition ¶ added in v0.2.0
type CachePartition struct {
ID int `json:"id"`
Node string `json:"node"`
KeyRange KeyRange `json:"key_range"`
Load float64 `json:"load"`
Health PartitionHealth `json:"health"`
}
CachePartition represents a cache partition
type CachePartitioner ¶ added in v0.2.0
type CachePartitioner struct {
// contains filtered or unexported fields
}
CachePartitioner handles cache partitioning across cluster nodes
func NewCachePartitioner ¶ added in v0.2.0
func NewCachePartitioner(config CachePartitionerConfig, strategy PartitionStrategy, count int, logger Logger) *CachePartitioner
func (*CachePartitioner) GetPartition ¶ added in v0.2.0
func (cp *CachePartitioner) GetPartition(key string) *CachePartition
func (*CachePartitioner) GetPartitionMetrics ¶ added in v0.2.0
func (cp *CachePartitioner) GetPartitionMetrics() []*PartitionMetrics
func (*CachePartitioner) Start ¶ added in v0.2.0
func (cp *CachePartitioner) Start() error
func (*CachePartitioner) Stop ¶ added in v0.2.0
func (cp *CachePartitioner) Stop() error
type CachePartitionerConfig ¶ added in v0.2.0
type CachePartitionerConfig struct {
RebalanceThreshold float64 `json:"rebalance_threshold"`
RebalanceInterval time.Duration `json:"rebalance_interval"`
MigrationBatchSize int `json:"migration_batch_size"`
HealthCheckInterval time.Duration `json:"health_check_interval"`
}
Configuration structures
type CacheSchedulerMetrics ¶ added in v0.3.0
type CacheWarmer ¶ added in v0.2.0
type CacheWarmer struct {
// contains filtered or unexported fields
}
CacheWarmer handles proactive cache warming
func NewCacheWarmer ¶ added in v0.2.0
func NewCacheWarmer(config CacheWarmerConfig, cache *RedisClusterCache, logger Logger) *CacheWarmer
func (*CacheWarmer) Start ¶ added in v0.2.0
func (cw *CacheWarmer) Start() error
func (*CacheWarmer) Stop ¶ added in v0.2.0
func (cw *CacheWarmer) Stop() error
type CacheWarmerConfig ¶ added in v0.2.0
type CacheWarmerConfig struct {
Strategies []string `json:"strategies"`
WarmingInterval time.Duration `json:"warming_interval"`
ConcurrentWorkers int `json:"concurrent_workers"`
BatchSize int `json:"batch_size"`
PredictionWindow time.Duration `json:"prediction_window"`
MinAccessThreshold int64 `json:"min_access_threshold"`
}
type CircuitBreaker ¶ added in v0.2.0
type CircuitBreaker struct {
// contains filtered or unexported fields
}
CircuitBreaker protects targets from overload
func NewCircuitBreaker ¶ added in v0.2.0
func NewCircuitBreaker(config CircuitBreakerConfig, logger Logger) *CircuitBreaker
func (*CircuitBreaker) RecordRequest ¶ added in v0.2.0
func (cb *CircuitBreaker) RecordRequest(targetID string, success bool)
type CircuitBreakerConfig ¶ added in v0.2.0
type CircuitBreakerConfig struct {
Enabled bool `json:"enabled"`
FailureThreshold int `json:"failure_threshold"`
SuccessThreshold int `json:"success_threshold"`
Timeout time.Duration `json:"timeout"`
HalfOpenMaxRequests int `json:"half_open_max_requests"`
FailureRate float64 `json:"failure_rate"`
MinimumRequests int `json:"minimum_requests"`
SlidingWindowSize int `json:"sliding_window_size"`
}
CircuitBreakerConfig defines circuit breaker configuration
type CircuitBreakerMetrics ¶ added in v0.2.0
type CircuitBreakerSettings ¶ added in v0.2.0
type CircuitState ¶ added in v0.2.0
type CircuitState string
CircuitState represents circuit breaker states
const ( CircuitClosed CircuitState = "closed" CircuitOpen CircuitState = "open" CircuitHalfOpen CircuitState = "half_open" )
type ClientPermissions ¶ added in v0.2.0
type ClientPermissions struct {
ReadMetrics bool `json:"read_metrics"`
WriteConfig bool `json:"write_config"`
ManageAlerts bool `json:"manage_alerts"`
ExportData bool `json:"export_data"`
}
ClientPermissions defines what a client can access
type ConcurrencyEngine ¶
type ConcurrencyEngine struct {
// contains filtered or unexported fields
}
ConcurrencyEngine manages advanced concurrency patterns for high-performance execution
func NewConcurrencyEngine ¶
func NewConcurrencyEngine(config ConcurrencyEngineConfig, logger Logger) *ConcurrencyEngine
NewConcurrencyEngine creates a new concurrency engine
func (*ConcurrencyEngine) CreatePipeline ¶
func (e *ConcurrencyEngine) CreatePipeline(config PipelineConfig, stages []StageProcessor) (*ExecutionPipeline, error)
CreatePipeline creates a new execution pipeline
func (*ConcurrencyEngine) CreateWorkerPool ¶ added in v0.2.0
func (e *ConcurrencyEngine) CreateWorkerPool(config WorkerPoolConfig, processor TaskProcessor) (*WorkerPool, error)
CreateWorkerPool creates a new worker pool
func (*ConcurrencyEngine) GetMetrics ¶
func (e *ConcurrencyEngine) GetMetrics() *ConcurrencyMetrics
GetMetrics returns concurrency engine metrics
func (*ConcurrencyEngine) Start ¶
func (e *ConcurrencyEngine) Start() error
Start starts the concurrency engine
func (*ConcurrencyEngine) Stop ¶
func (e *ConcurrencyEngine) Stop() error
Stop stops the concurrency engine
func (*ConcurrencyEngine) SubmitTask ¶ added in v0.2.0
func (e *ConcurrencyEngine) SubmitTask(task Task) error
SubmitTask submits a task for execution
func (*ConcurrencyEngine) SubmitTasks ¶ added in v0.2.0
func (e *ConcurrencyEngine) SubmitTasks(tasks []Task) error
SubmitTasks submits multiple tasks for execution
type ConcurrencyEngineConfig ¶ added in v0.2.0
type ConcurrencyEngineConfig struct {
// Worker pool settings
DefaultPoolSize int `json:"default_pool_size"`
MaxWorkers int `json:"max_workers"`
MinWorkers int `json:"min_workers"`
WorkerIdleTimeout time.Duration `json:"worker_idle_timeout"`
// Task scheduling
SchedulingAlgorithm SchedulingAlgorithm `json:"scheduling_algorithm"`
PriorityLevels int `json:"priority_levels"`
TaskTimeout time.Duration `json:"task_timeout"`
MaxQueueSize int `json:"max_queue_size"`
// Load balancing
BalancingStrategy BalancingStrategy `json:"balancing_strategy"`
HealthCheckInterval time.Duration `json:"health_check_interval"`
CircuitBreakerConfig CircuitBreakerSettings `json:"circuit_breaker"`
// Coordination
EnableCoordination bool `json:"enable_coordination"`
CoordinationMode CoordinationMode `json:"coordination_mode"`
HeartbeatInterval time.Duration `json:"heartbeat_interval"`
// Performance optimization
EnableAdaptiveScaling bool `json:"enable_adaptive_scaling"`
ScalingInterval time.Duration `json:"scaling_interval"`
CPUThreshold float64 `json:"cpu_threshold"`
MemoryThreshold float64 `json:"memory_threshold"`
// Monitoring
EnableMetrics bool `json:"enable_metrics"`
MetricsInterval time.Duration `json:"metrics_interval"`
}
ConcurrencyEngineConfig defines configuration for the concurrency engine
func DefaultConcurrencyEngineConfig ¶ added in v0.2.0
func DefaultConcurrencyEngineConfig() ConcurrencyEngineConfig
Default configuration
type ConcurrencyMetrics ¶
type ConcurrencyMetrics struct {
TotalWorkers int64 `json:"total_workers"`
ActiveWorkers int64 `json:"active_workers"`
IdleWorkers int64 `json:"idle_workers"`
TasksProcessed int64 `json:"tasks_processed"`
TasksQueued int64 `json:"tasks_queued"`
TasksFailed int64 `json:"tasks_failed"`
AverageLatency time.Duration `json:"average_latency"`
Throughput float64 `json:"throughput"`
ResourceUtilization ResourceStats `json:"resource_utilization"`
}
Various metrics structures
type ConsistentHashRing ¶ added in v0.2.0
type ConsistentHashRing struct {
// contains filtered or unexported fields
}
ConsistentHashRing implements consistent hashing for cache distribution
type CoordinationMode ¶ added in v0.2.0
type CoordinationMode string
CoordinationMode defines worker coordination modes
const ( CoordinationLocal CoordinationMode = "local" CoordinationDistributed CoordinationMode = "distributed" CoordinationHybrid CoordinationMode = "hybrid" )
type CoordinatorConfig ¶ added in v0.2.0
type CoordinatorMetrics ¶ added in v0.2.0
type DashboardClient ¶ added in v0.2.0
type DashboardClient struct {
ID string `json:"id"`
Conn *websocket.Conn `json:"-"`
Permissions ClientPermissions `json:"permissions"`
LastSeen time.Time `json:"last_seen"`
Subscriptions []string `json:"subscriptions"`
// contains filtered or unexported fields
}
DashboardClient represents a connected dashboard client
type DashboardConfig ¶ added in v0.2.0
type DashboardConfig struct {
// Server configuration
Host string `json:"host"`
Port int `json:"port"`
EnableTLS bool `json:"enable_tls"`
TLSCertFile string `json:"tls_cert_file"`
TLSKeyFile string `json:"tls_key_file"`
// Dashboard settings
UpdateInterval time.Duration `json:"update_interval"`
MaxClients int `json:"max_clients"`
ClientTimeout time.Duration `json:"client_timeout"`
// Data retention
HistoryDuration time.Duration `json:"history_duration"`
MaxDataPoints int `json:"max_data_points"`
// Authentication
EnableAuth bool `json:"enable_auth"`
AdminToken string `json:"admin_token"`
ReadOnlyToken string `json:"readonly_token"`
// Features
EnableAlerts bool `json:"enable_alerts"`
EnableExport bool `json:"enable_export"`
EnableDebug bool `json:"enable_debug"`
}
DashboardConfig defines configuration for the monitoring dashboard
func DefaultDashboardConfig ¶ added in v0.2.0
func DefaultDashboardConfig() DashboardConfig
DefaultDashboardConfig returns default configuration
type DashboardMetrics ¶ added in v0.2.0
type DashboardMetrics struct {
ConnectedClients int64 `json:"connected_clients"`
TotalConnections int64 `json:"total_connections"`
MessagesSent int64 `json:"messages_sent"`
MessagesReceived int64 `json:"messages_received"`
DataPointsStreamed int64 `json:"data_points_streamed"`
AverageLatency time.Duration `json:"average_latency"`
ErrorCount int64 `json:"error_count"`
}
DashboardMetrics tracks dashboard performance
type DefaultLogger ¶ added in v0.2.0
type DefaultLogger struct {
// contains filtered or unexported fields
}
DefaultLogger provides a simple logger implementation
func NewDefaultLogger ¶ added in v0.2.0
func NewDefaultLogger() *DefaultLogger
NewDefaultLogger creates a new default logger
func (*DefaultLogger) Debug ¶ added in v0.2.0
func (l *DefaultLogger) Debug(msg string, args ...interface{})
func (*DefaultLogger) Error ¶ added in v0.2.0
func (l *DefaultLogger) Error(msg string, args ...interface{})
func (*DefaultLogger) Info ¶ added in v0.2.0
func (l *DefaultLogger) Info(msg string, args ...interface{})
func (*DefaultLogger) Warn ¶ added in v0.2.0
func (l *DefaultLogger) Warn(msg string, args ...interface{})
type DiskMetrics ¶ added in v0.2.0
type DistributedRateLimitConfig ¶ added in v0.2.0
type DistributedRateLimitConfig struct {
// Redis connection
RedisAddr string `json:"redis_addr"`
RedisPassword string `json:"redis_password"`
RedisDB int `json:"redis_db"`
// Rate limiting configuration
KeyPrefix string `json:"key_prefix"`
DefaultLimit int64 `json:"default_limit"`
DefaultWindow time.Duration `json:"default_window"`
DefaultBurst int64 `json:"default_burst"`
// Algorithm settings
Algorithm RateLimitAlgorithm `json:"algorithm"`
SlidingWindowParts int `json:"sliding_window_parts"`
// Cleanup and maintenance
CleanupInterval time.Duration `json:"cleanup_interval"`
KeyExpiration time.Duration `json:"key_expiration"`
// Performance settings
EnablePipelining bool `json:"enable_pipelining"`
MaxRetries int `json:"max_retries"`
RetryDelay time.Duration `json:"retry_delay"`
// Monitoring
EnableMetrics bool `json:"enable_metrics"`
MetricsInterval time.Duration `json:"metrics_interval"`
}
DistributedRateLimitConfig defines configuration for distributed rate limiting
func DefaultDistributedRateLimitConfig ¶ added in v0.2.0
func DefaultDistributedRateLimitConfig() DistributedRateLimitConfig
DefaultDistributedRateLimitConfig returns default configuration
type DistributedRateLimiter ¶ added in v0.2.0
type DistributedRateLimiter struct {
// contains filtered or unexported fields
}
DistributedRateLimiter implements distributed rate limiting using Redis
func NewDistributedRateLimiter ¶ added in v0.2.0
func NewDistributedRateLimiter(config DistributedRateLimitConfig, logger Logger) (*DistributedRateLimiter, error)
NewDistributedRateLimiter creates a new distributed rate limiter
func (*DistributedRateLimiter) Allow ¶ added in v0.2.0
func (d *DistributedRateLimiter) Allow(request *RateLimitRequest) (*RateLimitResult, error)
Allow checks if a request is allowed under the rate limit
func (*DistributedRateLimiter) AllowN ¶ added in v0.2.0
func (d *DistributedRateLimiter) AllowN(key string, n int64) (*RateLimitResult, error)
AllowN checks if N requests are allowed under the rate limit
func (*DistributedRateLimiter) GetMetrics ¶ added in v0.2.0
func (d *DistributedRateLimiter) GetMetrics() *RateLimitMetrics
GetMetrics returns current rate limiting metrics
func (*DistributedRateLimiter) GetStatus ¶ added in v0.2.0
func (d *DistributedRateLimiter) GetStatus(key string) (*RateLimitResult, error)
GetStatus returns the current status for a key without consuming quota
func (*DistributedRateLimiter) Reset ¶ added in v0.2.0
func (d *DistributedRateLimiter) Reset(key string) error
Reset resets the rate limit for a key
func (*DistributedRateLimiter) Start ¶ added in v0.2.0
func (d *DistributedRateLimiter) Start() error
Start starts the distributed rate limiter
func (*DistributedRateLimiter) Stop ¶ added in v0.2.0
func (d *DistributedRateLimiter) Stop() error
Stop stops the distributed rate limiter
type ExecutionPipeline ¶ added in v0.2.0
type ExecutionPipeline struct {
// contains filtered or unexported fields
}
ExecutionPipeline manages multi-stage task execution
func NewExecutionPipeline ¶ added in v0.2.0
func NewExecutionPipeline(config PipelineConfig, stages []StageProcessor, logger Logger) *ExecutionPipeline
func (*ExecutionPipeline) Start ¶ added in v0.2.0
func (ep *ExecutionPipeline) Start() error
func (*ExecutionPipeline) Stop ¶ added in v0.2.0
func (ep *ExecutionPipeline) Stop() error
type ExecutorMetrics ¶ added in v0.2.0
type GoroutineMetrics ¶ added in v0.2.0
type GoroutineProfiler ¶ added in v0.2.0
type GoroutineProfiler struct {
// contains filtered or unexported fields
}
func (*GoroutineProfiler) Collect ¶ added in v0.2.0
func (gp *GoroutineProfiler) Collect() (*ProfileData, error)
func (*GoroutineProfiler) GetName ¶ added in v0.2.0
func (gp *GoroutineProfiler) GetName() string
func (*GoroutineProfiler) IsEnabled ¶ added in v0.2.0
func (gp *GoroutineProfiler) IsEnabled() bool
func (*GoroutineProfiler) Start ¶ added in v0.2.0
func (gp *GoroutineProfiler) Start() error
func (*GoroutineProfiler) Stop ¶ added in v0.2.0
func (gp *GoroutineProfiler) Stop() error
type HealthCheck ¶ added in v0.2.0
type HealthCheck struct {
Type HealthCheckType `json:"type"`
Endpoint string `json:"endpoint"`
Method string `json:"method"`
Headers map[string]string `json:"headers"`
Body string `json:"body"`
ExpectedCode int `json:"expected_code"`
Timeout time.Duration `json:"timeout"`
Interval time.Duration `json:"interval"`
Retries int `json:"retries"`
}
HealthCheck represents a health check configuration
type HealthCheckType ¶ added in v0.2.0
type HealthCheckType string
HealthCheckType defines health check types
const ( HealthCheckHTTP HealthCheckType = "http" HealthCheckTCP HealthCheckType = "tcp" HealthCheckPing HealthCheckType = "ping" HealthCheckCustom HealthCheckType = "custom" )
type HealthChecker ¶ added in v0.2.0
type HealthChecker struct {
// contains filtered or unexported fields
}
type HealthMetrics ¶ added in v0.2.0
type HealthMetrics struct {
TotalChecks int64 `json:"total_checks"`
SuccessfulChecks int64 `json:"successful_checks"`
FailedChecks int64 `json:"failed_checks"`
AverageLatency time.Duration `json:"average_latency"`
}
Metrics structures
type HealthMonitor ¶ added in v0.2.0
type HealthMonitor struct {
// contains filtered or unexported fields
}
HealthMonitor monitors target health
func NewHealthMonitor ¶ added in v0.2.0
func NewHealthMonitor(config HealthMonitorConfig, logger Logger) *HealthMonitor
Placeholder implementations for missing components
func (*HealthMonitor) AddTarget ¶ added in v0.2.0
func (hm *HealthMonitor) AddTarget(target *LoadBalanceTarget)
func (*HealthMonitor) RemoveTarget ¶ added in v0.2.0
func (hm *HealthMonitor) RemoveTarget(target *LoadBalanceTarget)
func (*HealthMonitor) Start ¶ added in v0.2.0
func (hm *HealthMonitor) Start() error
func (*HealthMonitor) Stop ¶ added in v0.2.0
func (hm *HealthMonitor) Stop() error
type HealthMonitorConfig ¶ added in v0.2.0
type HealthMonitorConfig struct {
Enabled bool `json:"enabled"`
CheckInterval time.Duration `json:"check_interval"`
Timeout time.Duration `json:"timeout"`
HealthyThreshold int `json:"healthy_threshold"`
UnhealthyThreshold int `json:"unhealthy_threshold"`
MaxConcurrentChecks int `json:"max_concurrent_checks"`
}
Configuration structures
type HeartbeatManager ¶ added in v0.2.0
type HeartbeatManager struct {
// contains filtered or unexported fields
}
type Hotspot ¶ added in v0.2.0
type Hotspot struct {
Function string `json:"function"`
File string `json:"file"`
Line int `json:"line"`
CPUPercent float64 `json:"cpu_percent"`
MemoryBytes int64 `json:"memory_bytes"`
CallCount int64 `json:"call_count"`
TotalTime time.Duration `json:"total_time"`
AverageTime time.Duration `json:"average_time"`
Severity Severity `json:"severity"`
}
Hotspot represents a performance hotspot
type InvalidationCallback ¶ added in v0.2.0
type InvalidationCallback func(key string, entry *CacheEntry, reason string)
InvalidationCallback is called when cache entries are invalidated
type InvalidationHandler ¶ added in v0.2.0
type InvalidationHandler interface {
ShouldInvalidate(entry *CacheEntry) bool
Invalidate(key string, entry *CacheEntry) error
}
InvalidationHandler handles specific invalidation strategies
type InvalidationStrategy ¶ added in v0.2.0
type InvalidationStrategy string
InvalidationStrategy defines cache invalidation strategies
const ( InvalidationLRU InvalidationStrategy = "lru" InvalidationTTL InvalidationStrategy = "ttl" InvalidationTags InvalidationStrategy = "tags" InvalidationCallbackStrategy InvalidationStrategy = "callback" )
type InvalidatorMetrics ¶ added in v0.2.0
type IssueType ¶ added in v0.2.0
type IssueType string
IssueType defines types of performance issues
type LoadBalanceTarget ¶
type LoadBalanceTarget struct {
ID string `json:"id"`
Address string `json:"address"`
Weight int `json:"weight"`
MaxConcurrency int `json:"max_concurrency"`
CurrentLoad int64 `json:"current_load"`
HealthStatus TargetHealthStatus `json:"health_status"`
ResponseTime time.Duration `json:"response_time"`
SuccessRate float64 `json:"success_rate"`
LastHealthCheck time.Time `json:"last_health_check"`
Capabilities []string `json:"capabilities"`
Metadata map[string]interface{} `json:"metadata"`
CircuitState CircuitState `json:"circuit_state"`
Statistics *TargetStatistics `json:"statistics"`
// contains filtered or unexported fields
}
LoadBalanceTarget represents a target for load balancing
type LoadBalancer ¶ added in v0.2.0
type LoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer distributes tasks across available resources
func NewLoadBalancer ¶
func NewLoadBalancer(config BalancerConfig, logger Logger) *LoadBalancer
func (*LoadBalancer) Start ¶ added in v0.2.0
func (lb *LoadBalancer) Start() error
func (*LoadBalancer) Stop ¶ added in v0.2.0
func (lb *LoadBalancer) Stop() error
type LoadBalancerConfig ¶ added in v0.2.0
type LoadBalancerConfig struct {
// Basic settings
Name string `json:"name"`
DefaultStrategy BalancingStrategy `json:"default_strategy"`
EnableHealthChecks bool `json:"enable_health_checks"`
HealthCheckInterval time.Duration `json:"health_check_interval"`
// Circuit breaker settings
CircuitBreaker CircuitBreakerConfig `json:"circuit_breaker"`
// Auto-scaling settings
AutoScaling AutoScalingConfig `json:"auto_scaling"`
// Load prediction
LoadPrediction LoadPredictionConfig `json:"load_prediction"`
// Advanced features
EnableStickySessions bool `json:"enable_sticky_sessions"`
SessionTimeout time.Duration `json:"session_timeout"`
EnableWeighting bool `json:"enable_weighting"`
WeightAdjustment WeightConfig `json:"weight_adjustment"`
// Performance tuning
MaxConcurrentChecks int `json:"max_concurrent_checks"`
RequestTimeout time.Duration `json:"request_timeout"`
RetryAttempts int `json:"retry_attempts"`
RetryDelay time.Duration `json:"retry_delay"`
// Monitoring
EnableMetrics bool `json:"enable_metrics"`
MetricsInterval time.Duration `json:"metrics_interval"`
EnablePredictive bool `json:"enable_predictive"`
}
LoadBalancerConfig defines comprehensive load balancer configuration
func DefaultLoadBalancerConfig ¶ added in v0.2.0
func DefaultLoadBalancerConfig() LoadBalancerConfig
Default configurations
type LoadBalancerDataPoint ¶ added in v0.3.0
type LoadBalancerMetrics ¶ added in v0.2.0
type LoadBalancerMetrics struct {
TotalRequests int64 `json:"total_requests"`
SuccessfulRequests int64 `json:"successful_requests"`
FailedRequests int64 `json:"failed_requests"`
AverageLatency time.Duration `json:"average_latency"`
RequestsPerSecond float64 `json:"requests_per_second"`
ActiveTargets int `json:"active_targets"`
HealthyTargets int `json:"healthy_targets"`
CircuitBreakerTrips int64 `json:"circuit_breaker_trips"`
ScalingEvents int64 `json:"scaling_events"`
TargetMetrics map[string]*TargetStatistics `json:"target_metrics"`
}
LoadBalancerMetrics tracks load balancer performance
type LoadDataPoint ¶ added in v0.2.0
type LoadForecast ¶ added in v0.2.0
type LoadForecast struct {
Predictions []PredictionPoint `json:"predictions"`
Confidence float64 `json:"confidence"`
GeneratedAt time.Time `json:"generated_at"`
Algorithm PredictionAlgorithm `json:"algorithm"`
}
type LoadHistory ¶ added in v0.2.0
type LoadHistory struct {
DataPoints []LoadDataPoint `json:"data_points"`
// contains filtered or unexported fields
}
type LoadPredictionConfig ¶ added in v0.2.0
type LoadPredictionConfig struct {
Enabled bool `json:"enabled"`
Algorithm PredictionAlgorithm `json:"algorithm"`
HistoryDuration time.Duration `json:"history_duration"`
PredictionHorizon time.Duration `json:"prediction_horizon"`
UpdateInterval time.Duration `json:"update_interval"`
ConfidenceThreshold float64 `json:"confidence_threshold"`
SeasonalityDetection bool `json:"seasonality_detection"`
TrendAnalysis bool `json:"trend_analysis"`
}
LoadPredictionConfig defines load prediction configuration
type LoadPredictor ¶
type LoadPredictor struct {
// contains filtered or unexported fields
}
LoadPredictor predicts future load patterns
func NewLoadPredictor ¶ added in v0.2.0
func NewLoadPredictor(config LoadPredictionConfig, logger Logger) *LoadPredictor
func (*LoadPredictor) Start ¶ added in v0.2.0
func (lp *LoadPredictor) Start() error
func (*LoadPredictor) Stop ¶ added in v0.2.0
func (lp *LoadPredictor) Stop() error
type Logger ¶
type Logger interface {
Info(msg string, args ...interface{})
Warn(msg string, args ...interface{})
Error(msg string, args ...interface{})
Debug(msg string, args ...interface{})
}
Logger interface for memory pool logging
type MapFactory ¶ added in v0.2.0
type MapFactory struct {
InitialSize int
}
MapFactory creates map pools
func NewMapFactory ¶ added in v0.2.0
func NewMapFactory(initialSize int) *MapFactory
func (*MapFactory) CreateObject ¶ added in v0.2.0
func (f *MapFactory) CreateObject() interface{}
func (*MapFactory) GetObjectType ¶ added in v0.2.0
func (f *MapFactory) GetObjectType() string
type MapReset ¶ added in v0.2.0
type MapReset struct{}
MapReset resets maps
func (*MapReset) ResetObject ¶ added in v0.2.0
type MemoryMetrics ¶ added in v0.2.0
type MemoryMetrics struct {
Allocated uint64 `json:"allocated"`
TotalAlloc uint64 `json:"total_alloc"`
Sys uint64 `json:"sys"`
Lookups uint64 `json:"lookups"`
Mallocs uint64 `json:"mallocs"`
Frees uint64 `json:"frees"`
HeapAlloc uint64 `json:"heap_alloc"`
HeapSys uint64 `json:"heap_sys"`
HeapIdle uint64 `json:"heap_idle"`
HeapInuse uint64 `json:"heap_inuse"`
HeapReleased uint64 `json:"heap_released"`
HeapObjects uint64 `json:"heap_objects"`
StackInuse uint64 `json:"stack_inuse"`
StackSys uint64 `json:"stack_sys"`
MSpanInuse uint64 `json:"mspan_inuse"`
MSpanSys uint64 `json:"mspan_sys"`
MCacheInuse uint64 `json:"mcache_inuse"`
MCacheSys uint64 `json:"mcache_sys"`
BuckHashSys uint64 `json:"buck_hash_sys"`
GCSys uint64 `json:"gc_sys"`
OtherSys uint64 `json:"other_sys"`
NextGC uint64 `json:"next_gc"`
}
type MemoryPoolConfig ¶ added in v0.2.0
type MemoryPoolConfig struct {
// Pool sizing
DefaultPoolSize int `json:"default_pool_size"`
MaxPoolSize int `json:"max_pool_size"`
MinPoolSize int `json:"min_pool_size"`
// Object lifecycle
MaxObjectAge time.Duration `json:"max_object_age"`
CleanupInterval time.Duration `json:"cleanup_interval"`
PreallocationSize int `json:"preallocation_size"`
// Memory management
EnableGCOptimization bool `json:"enable_gc_optimization"`
GCTarget int `json:"gc_target"`
MaxMemoryUsage int64 `json:"max_memory_usage"`
// Monitoring
EnableMetrics bool `json:"enable_metrics"`
MetricsInterval time.Duration `json:"metrics_interval"`
}
MemoryPoolConfig defines configuration for memory pools
func DefaultMemoryPoolConfig ¶ added in v0.2.0
func DefaultMemoryPoolConfig() MemoryPoolConfig
DefaultMemoryPoolConfig returns default configuration
type MemoryPoolManager ¶ added in v0.2.0
type MemoryPoolManager struct {
// contains filtered or unexported fields
}
MemoryPoolManager manages object pools for memory optimization
func NewMemoryPoolManager ¶ added in v0.2.0
func NewMemoryPoolManager(config MemoryPoolConfig, logger Logger) *MemoryPoolManager
NewMemoryPoolManager creates a new memory pool manager
func (*MemoryPoolManager) CreatePool ¶ added in v0.2.0
func (m *MemoryPoolManager) CreatePool(name string, factory ObjectFactory, reset ObjectReset) (*ObjectPool, error)
CreatePool creates a new object pool
func (*MemoryPoolManager) Get ¶ added in v0.2.0
func (m *MemoryPoolManager) Get(poolName string) (interface{}, error)
Get retrieves an object from a pool
func (*MemoryPoolManager) GetMetrics ¶ added in v0.2.0
func (m *MemoryPoolManager) GetMetrics() *MemoryPoolMetrics
GetMetrics returns current memory pool metrics
func (*MemoryPoolManager) GetPool ¶ added in v0.2.0
func (m *MemoryPoolManager) GetPool(name string) (*ObjectPool, error)
GetPool returns an object pool by name
func (*MemoryPoolManager) GetPoolMetrics ¶ added in v0.2.0
func (m *MemoryPoolManager) GetPoolMetrics() []*ObjectPoolMetrics
GetPoolMetrics returns metrics for all pools
func (*MemoryPoolManager) Put ¶ added in v0.2.0
func (m *MemoryPoolManager) Put(poolName string, obj interface{}) error
Put returns an object to a pool
func (*MemoryPoolManager) Start ¶ added in v0.2.0
func (m *MemoryPoolManager) Start() error
Start starts the memory pool manager
func (*MemoryPoolManager) Stop ¶ added in v0.2.0
func (m *MemoryPoolManager) Stop() error
Stop stops the memory pool manager
type MemoryPoolMetrics ¶ added in v0.2.0
type MemoryPoolMetrics struct {
TotalPools int64 `json:"total_pools"`
TotalObjects int64 `json:"total_objects"`
ObjectsCreated int64 `json:"objects_created"`
ObjectsReused int64 `json:"objects_reused"`
ObjectsDestroyed int64 `json:"objects_destroyed"`
MemoryAllocated int64 `json:"memory_allocated"`
MemoryReleased int64 `json:"memory_released"`
PoolHitRate float64 `json:"pool_hit_rate"`
AverageObjectAge time.Duration `json:"average_object_age"`
}
MemoryPoolMetrics tracks memory pool performance
type MemoryProfiler ¶
type MemoryProfiler struct {
// contains filtered or unexported fields
}
func (*MemoryProfiler) Collect ¶ added in v0.2.0
func (mp *MemoryProfiler) Collect() (*ProfileData, error)
func (*MemoryProfiler) GetName ¶ added in v0.2.0
func (mp *MemoryProfiler) GetName() string
func (*MemoryProfiler) IsEnabled ¶ added in v0.2.0
func (mp *MemoryProfiler) IsEnabled() bool
func (*MemoryProfiler) Start ¶ added in v0.2.0
func (mp *MemoryProfiler) Start() error
func (*MemoryProfiler) Stop ¶ added in v0.2.0
func (mp *MemoryProfiler) Stop() error
type MetricsCollector ¶
type MetricsCollector interface {
GetMetrics() map[string]interface{}
GetName() string
IsEnabled() bool
}
MetricsCollector interface for collecting metrics from various sources
type MetricsMessage ¶ added in v0.2.0
type MetricsMessage struct {
Type string `json:"type"`
Timestamp time.Time `json:"timestamp"`
Source string `json:"source"`
Metrics map[string]interface{} `json:"metrics"`
}
MetricsMessage represents a real-time metrics update
type MonitoringDashboard ¶
type MonitoringDashboard struct {
// contains filtered or unexported fields
}
MonitoringDashboard provides real-time monitoring and metrics visualization
func NewMonitoringDashboard ¶ added in v0.2.0
func NewMonitoringDashboard(config DashboardConfig, logger Logger) *MonitoringDashboard
NewMonitoringDashboard creates a new monitoring dashboard
func (*MonitoringDashboard) AddMetricsCollector ¶ added in v0.2.0
func (d *MonitoringDashboard) AddMetricsCollector(collector MetricsCollector)
AddMetricsCollector adds a metrics collector
func (*MonitoringDashboard) BroadcastAlert ¶ added in v0.2.0
func (d *MonitoringDashboard) BroadcastAlert(alert AlertMessage)
BroadcastAlert broadcasts an alert to all connected clients
func (*MonitoringDashboard) GetMetrics ¶ added in v0.2.0
func (d *MonitoringDashboard) GetMetrics() *DashboardMetrics
GetMetrics returns dashboard metrics
func (*MonitoringDashboard) RemoveMetricsCollector ¶ added in v0.2.0
func (d *MonitoringDashboard) RemoveMetricsCollector(name string)
RemoveMetricsCollector removes a metrics collector
func (*MonitoringDashboard) Start ¶ added in v0.2.0
func (d *MonitoringDashboard) Start() error
Start starts the monitoring dashboard server
func (*MonitoringDashboard) Stop ¶ added in v0.2.0
func (d *MonitoringDashboard) Stop() error
Stop stops the monitoring dashboard
type MutexProfiler ¶ added in v0.2.0
type MutexProfiler struct {
// contains filtered or unexported fields
}
func (*MutexProfiler) Collect ¶ added in v0.2.0
func (mp *MutexProfiler) Collect() (*ProfileData, error)
func (*MutexProfiler) GetName ¶ added in v0.2.0
func (mp *MutexProfiler) GetName() string
func (*MutexProfiler) IsEnabled ¶ added in v0.2.0
func (mp *MutexProfiler) IsEnabled() bool
func (*MutexProfiler) Start ¶ added in v0.2.0
func (mp *MutexProfiler) Start() error
func (*MutexProfiler) Stop ¶ added in v0.2.0
func (mp *MutexProfiler) Stop() error
type NetworkMetrics ¶ added in v0.2.0
type NodeInfo ¶ added in v0.2.0
type NodeInfo struct {
ID string `json:"id"`
Address string `json:"address"`
Status NodeStatus `json:"status"`
LastSeen time.Time `json:"last_seen"`
Capabilities []string `json:"capabilities"`
Load NodeLoad `json:"load"`
Metadata map[string]interface{} `json:"metadata"`
}
NodeInfo represents information about a worker node
type NodeLoad ¶ added in v0.2.0
type NodeLoad struct {
CPU float64 `json:"cpu"`
Memory float64 `json:"memory"`
Network float64 `json:"network"`
TaskCount int `json:"task_count"`
QueueDepth int `json:"queue_depth"`
}
NodeLoad represents node resource utilization
type NodeStatus ¶ added in v0.2.0
type NodeStatus string
NodeStatus represents node states
const ( NodeStatusHealthy NodeStatus = "healthy" NodeStatusDegraded NodeStatus = "degraded" NodeStatusUnhealthy NodeStatus = "unhealthy" )
type ObjectFactory ¶ added in v0.2.0
type ObjectFactory interface {
CreateObject() interface{}
GetObjectType() string
}
ObjectFactory creates new objects for the pool
type ObjectPool ¶
type ObjectPool struct {
// contains filtered or unexported fields
}
ObjectPool manages a pool of reusable objects
func (*ObjectPool) Get ¶
func (p *ObjectPool) Get() (interface{}, error)
Get retrieves an object from the pool
func (*ObjectPool) GetMetrics ¶ added in v0.2.0
func (p *ObjectPool) GetMetrics() *ObjectPoolMetrics
GetMetrics returns pool metrics
func (*ObjectPool) Put ¶
func (p *ObjectPool) Put(obj interface{}) error
Put returns an object to the pool
type ObjectPoolMetrics ¶ added in v0.2.0
type ObjectPoolMetrics struct {
PoolName string `json:"pool_name"`
PoolSize int `json:"pool_size"`
ObjectsCreated int64 `json:"objects_created"`
ObjectsReused int64 `json:"objects_reused"`
ObjectsDestroyed int64 `json:"objects_destroyed"`
HitRate float64 `json:"hit_rate"`
AverageAge time.Duration `json:"average_age"`
LastCleanup time.Time `json:"last_cleanup"`
}
ObjectPoolMetrics tracks individual pool performance
type ObjectReset ¶ added in v0.2.0
type ObjectReset interface {
ResetObject(obj interface{}) error
}
ObjectReset resets objects for reuse
type OptimizationResult ¶
type OptimizationResult struct {
Strategy string `json:"strategy"`
Timestamp time.Time `json:"timestamp"`
Applied bool `json:"applied"`
Description string `json:"description"`
Parameters map[string]interface{} `json:"parameters"`
BeforeMetrics *PerformanceMetrics `json:"before_metrics"`
AfterMetrics *PerformanceMetrics `json:"after_metrics"`
Improvement float64 `json:"improvement"`
Error string `json:"error,omitempty"`
}
OptimizationResult represents the result of an optimization
type OptimizationStrategy ¶ added in v0.2.0
type OptimizationStrategy interface {
CanOptimize(metrics *PerformanceMetrics) bool
Optimize(metrics *PerformanceMetrics) (*OptimizationResult, error)
GetName() string
GetPriority() int
}
OptimizationStrategy defines optimization strategies
type OptimizerConfig ¶ added in v0.2.0
type OptimizerConfig struct {
Strategies []string `json:"strategies"`
OptimizationInterval time.Duration `json:"optimization_interval"`
MaxOptimizations int `json:"max_optimizations"`
SafetyMode bool `json:"safety_mode"`
}
Configuration structures
type OptimizerMetrics ¶ added in v0.2.0
type PartitionHealth ¶ added in v0.2.0
type PartitionHealth string
PartitionHealth represents partition health status
const ( PartitionHealthy PartitionHealth = "healthy" PartitionDegraded PartitionHealth = "degraded" PartitionUnhealthy PartitionHealth = "unhealthy" )
type PartitionMetrics ¶ added in v0.2.0
type PartitionMetrics struct {
PartitionID int `json:"partition_id"`
Load float64 `json:"load"`
KeyCount int64 `json:"key_count"`
DataSize int64 `json:"data_size"`
Health PartitionHealth `json:"health"`
}
type PartitionStrategy ¶ added in v0.2.0
type PartitionStrategy string
PartitionStrategy defines cache partitioning strategies
const ( PartitionByHash PartitionStrategy = "hash" PartitionByRange PartitionStrategy = "range" PartitionByConsistent PartitionStrategy = "consistent" PartitionByLoad PartitionStrategy = "load" )
type PartitionerMetrics ¶ added in v0.2.0
type PerformanceAnalyzer ¶
type PerformanceAnalyzer struct {
// contains filtered or unexported fields
}
PerformanceAnalyzer analyzes performance data and identifies issues
func NewPerformanceAnalyzer ¶
func NewPerformanceAnalyzer(config AnalyzerConfig, logger Logger) *PerformanceAnalyzer
func (*PerformanceAnalyzer) AnalyzeMetrics ¶ added in v0.2.0
func (pa *PerformanceAnalyzer) AnalyzeMetrics(metrics *PerformanceMetrics)
func (*PerformanceAnalyzer) GetHotspots ¶ added in v0.2.0
func (pa *PerformanceAnalyzer) GetHotspots() []*Hotspot
func (*PerformanceAnalyzer) GetIssues ¶ added in v0.2.0
func (pa *PerformanceAnalyzer) GetIssues() []*PerformanceIssue
func (*PerformanceAnalyzer) Start ¶
func (pa *PerformanceAnalyzer) Start() error
func (*PerformanceAnalyzer) Stop ¶
func (pa *PerformanceAnalyzer) Stop() error
type PerformanceIssue ¶ added in v0.2.0
type PerformanceIssue struct {
Type IssueType `json:"type"`
Severity Severity `json:"severity"`
Title string `json:"title"`
Description string `json:"description"`
Component string `json:"component"`
DetectedAt time.Time `json:"detected_at"`
Metadata map[string]interface{} `json:"metadata"`
Suggestions []string `json:"suggestions"`
Impact float64 `json:"impact"`
}
PerformanceIssue represents a detected performance issue
type PerformanceMetrics ¶
type PerformanceMetrics struct {
Timestamp time.Time `json:"timestamp"`
CPU CPUMetrics `json:"cpu"`
Memory MemoryMetrics `json:"memory"`
Goroutines GoroutineMetrics `json:"goroutines"`
GC GCMetrics `json:"gc"`
Network NetworkMetrics `json:"network"`
Disk DiskMetrics `json:"disk"`
Application ApplicationMetrics `json:"application"`
}
PerformanceMetrics comprehensive performance metrics
type PerformanceOptimizer ¶ added in v0.2.0
type PerformanceOptimizer struct {
// contains filtered or unexported fields
}
PerformanceOptimizer handles automatic performance optimizations
func NewPerformanceOptimizer ¶ added in v0.2.0
func NewPerformanceOptimizer(config OptimizerConfig, logger Logger) *PerformanceOptimizer
Placeholder implementations for referenced components
func (*PerformanceOptimizer) Start ¶ added in v0.2.0
func (po *PerformanceOptimizer) Start() error
func (*PerformanceOptimizer) Stop ¶ added in v0.2.0
func (po *PerformanceOptimizer) Stop() error
type PerformanceProfiler ¶ added in v0.2.0
type PerformanceProfiler struct {
// contains filtered or unexported fields
}
PerformanceProfiler provides comprehensive performance profiling and optimization
func NewPerformanceProfiler ¶ added in v0.2.0
func NewPerformanceProfiler(config ProfilerConfig, logger Logger) (*PerformanceProfiler, error)
NewPerformanceProfiler creates a new performance profiler
func (*PerformanceProfiler) CollectMetrics ¶ added in v0.2.0
func (p *PerformanceProfiler) CollectMetrics() *PerformanceMetrics
CollectMetrics collects current performance metrics
func (*PerformanceProfiler) GenerateReport ¶ added in v0.2.0
func (p *PerformanceProfiler) GenerateReport(period ReportPeriod) (*PerformanceReport, error)
GenerateReport generates a comprehensive performance report
func (*PerformanceProfiler) GetMetrics ¶ added in v0.2.0
func (p *PerformanceProfiler) GetMetrics() *ProfilerMetrics
GetMetrics returns profiler metrics
func (*PerformanceProfiler) Start ¶ added in v0.2.0
func (p *PerformanceProfiler) Start() error
Start starts the performance profiler
func (*PerformanceProfiler) Stop ¶ added in v0.2.0
func (p *PerformanceProfiler) Stop() error
Stop stops the performance profiler
type PerformanceReport ¶ added in v0.2.0
type PerformanceReport struct {
GeneratedAt time.Time `json:"generated_at"`
Period ReportPeriod `json:"period"`
Summary *PerformanceSummary `json:"summary"`
Metrics *PerformanceMetrics `json:"metrics"`
Hotspots []*Hotspot `json:"hotspots"`
Issues []*PerformanceIssue `json:"issues"`
Optimizations []*OptimizationResult `json:"optimizations"`
Trends *TrendAnalysis `json:"trends"`
Recommendations []string `json:"recommendations"`
}
PerformanceReport represents a comprehensive performance report
type PerformanceReporter ¶ added in v0.2.0
type PerformanceReporter struct {
// contains filtered or unexported fields
}
PerformanceReporter generates performance reports
func NewPerformanceReporter ¶ added in v0.2.0
func NewPerformanceReporter(config ReporterConfig, logger Logger) *PerformanceReporter
func (*PerformanceReporter) GenerateReport ¶ added in v0.2.0
func (pr *PerformanceReporter) GenerateReport(period ReportPeriod) (*PerformanceReport, error)
func (*PerformanceReporter) Start ¶ added in v0.2.0
func (pr *PerformanceReporter) Start() error
func (*PerformanceReporter) Stop ¶ added in v0.2.0
func (pr *PerformanceReporter) Stop() error
type PerformanceSummary ¶ added in v0.2.0
type PerformanceSummary struct {
OverallScore float64 `json:"overall_score"`
CPUScore float64 `json:"cpu_score"`
MemoryScore float64 `json:"memory_score"`
LatencyScore float64 `json:"latency_score"`
ThroughputScore float64 `json:"throughput_score"`
TotalIssues int `json:"total_issues"`
CriticalIssues int `json:"critical_issues"`
Uptime time.Duration `json:"uptime"`
}
PerformanceSummary provides a high-level performance summary
type PerformanceThresholds ¶ added in v0.2.0
type PerformanceThresholds struct {
MaxCPUUsage float64 `json:"max_cpu_usage"`
MaxMemoryUsage int64 `json:"max_memory_usage"`
MaxGoroutines int `json:"max_goroutines"`
MaxLatency time.Duration `json:"max_latency"`
MaxErrorRate float64 `json:"max_error_rate"`
MinThroughput float64 `json:"min_throughput"`
}
PerformanceThresholds defines performance alert thresholds
type PipelineConfig ¶ added in v0.2.0
type PipelineMetrics ¶ added in v0.2.0
type PipelineResult ¶ added in v0.2.0
type PipelineStage ¶
type PipelineStage struct {
// contains filtered or unexported fields
}
PipelineStage represents a stage in an execution pipeline
type PoolMetrics ¶ added in v0.2.0
type PoolMetrics struct {
PoolName string `json:"pool_name"`
WorkerCount int `json:"worker_count"`
ActiveTasks int64 `json:"active_tasks"`
CompletedTasks int64 `json:"completed_tasks"`
FailedTasks int64 `json:"failed_tasks"`
QueueDepth int `json:"queue_depth"`
AverageWaitTime time.Duration `json:"average_wait_time"`
Throughput float64 `json:"throughput"`
}
type PooledObject ¶ added in v0.2.0
type PooledObject struct {
Object interface{} `json:"object"`
CreatedAt time.Time `json:"created_at"`
UsedCount int64 `json:"used_count"`
LastUsed time.Time `json:"last_used"`
}
PooledObject represents an object in the pool
type PredictionAlgorithm ¶ added in v0.2.0
type PredictionAlgorithm string
PredictionAlgorithm defines prediction algorithms
const ( PredictionLinearRegression PredictionAlgorithm = "linear_regression" PredictionExponentialSmoothing PredictionAlgorithm = "exponential_smoothing" PredictionARIMA PredictionAlgorithm = "arima" PredictionNeuralNetwork PredictionAlgorithm = "neural_network" PredictionEnsemble PredictionAlgorithm = "ensemble" )
type PredictionMetrics ¶ added in v0.2.0
type PredictionModel ¶ added in v0.2.0
type PredictionPoint ¶ added in v0.2.0
type PredictorConfig ¶ added in v0.2.0
type PriorityQueue ¶ added in v0.2.0
type PriorityQueue struct {
// contains filtered or unexported fields
}
Placeholder implementations for referenced types
type ProfileData ¶ added in v0.2.0
type ProfileData struct {
Type string `json:"type"`
Timestamp time.Time `json:"timestamp"`
Duration time.Duration `json:"duration"`
Data []byte `json:"data"`
Metadata map[string]interface{} `json:"metadata"`
FilePath string `json:"file_path"`
Size int64 `json:"size"`
}
ProfileData represents collected profiling data
type Profiler ¶ added in v0.2.0
type Profiler interface {
Start() error
Stop() error
Collect() (*ProfileData, error)
GetName() string
IsEnabled() bool
}
Profiler interface for different types of profilers
func NewBlockProfiler ¶ added in v0.2.0
func NewCPUProfiler ¶ added in v0.2.0
Individual profiler implementations
func NewGoroutineProfiler ¶ added in v0.2.0
func NewMemoryProfiler ¶
func NewMutexProfiler ¶ added in v0.2.0
func NewTraceProfiler ¶ added in v0.2.0
type ProfilerConfig ¶ added in v0.2.0
type ProfilerConfig struct {
// Profiling settings
EnableCPUProfiling bool `json:"enable_cpu_profiling"`
EnableMemoryProfiling bool `json:"enable_memory_profiling"`
EnableGoroutineProfiling bool `json:"enable_goroutine_profiling"`
EnableBlockProfiling bool `json:"enable_block_profiling"`
EnableMutexProfiling bool `json:"enable_mutex_profiling"`
EnableTraceProfiling bool `json:"enable_trace_profiling"`
// Collection intervals
ProfilingInterval time.Duration `json:"profiling_interval"`
MetricsInterval time.Duration `json:"metrics_interval"`
OptimizationInterval time.Duration `json:"optimization_interval"`
// Storage settings
ProfilesDir string `json:"profiles_dir"`
MaxProfileFiles int `json:"max_profile_files"`
ProfileRetention time.Duration `json:"profile_retention"`
// Server settings
ServerEnabled bool `json:"server_enabled"`
ServerHost string `json:"server_host"`
ServerPort int `json:"server_port"`
// Analysis settings
AnalysisEnabled bool `json:"analysis_enabled"`
AnalysisDepth int `json:"analysis_depth"`
HotspotThreshold float64 `json:"hotspot_threshold"`
MemoryLeakThreshold int64 `json:"memory_leak_threshold"`
// Optimization settings
AutoOptimization bool `json:"auto_optimization"`
OptimizationStrategies []string `json:"optimization_strategies"`
GCTuningEnabled bool `json:"gc_tuning_enabled"`
PoolOptimizationEnabled bool `json:"pool_optimization_enabled"`
// Alerting
AlertsEnabled bool `json:"alerts_enabled"`
PerformanceThresholds PerformanceThresholds `json:"performance_thresholds"`
}
ProfilerConfig defines configuration for performance profiling
func DefaultProfilerConfig ¶ added in v0.2.0
func DefaultProfilerConfig() ProfilerConfig
Default configuration
type ProfilerMetrics ¶ added in v0.2.0
type ProfilerMetrics struct {
ProfilesCollected int64 `json:"profiles_collected"`
AnalysesPerformed int64 `json:"analyses_performed"`
OptimizationsApplied int64 `json:"optimizations_applied"`
IssuesDetected int64 `json:"issues_detected"`
AlertsTriggered int64 `json:"alerts_triggered"`
AverageAnalysisTime time.Duration `json:"average_analysis_time"`
}
Metrics structures
type RateLimitAlgorithm ¶ added in v0.2.0
type RateLimitAlgorithm string
RateLimitAlgorithm defines the rate limiting algorithm
const ( AlgorithmTokenBucket RateLimitAlgorithm = "token_bucket" AlgorithmSlidingWindow RateLimitAlgorithm = "sliding_window" AlgorithmFixedWindow RateLimitAlgorithm = "fixed_window" AlgorithmLeakyBucket RateLimitAlgorithm = "leaky_bucket" )
type RateLimitMetrics ¶ added in v0.2.0
type RateLimitMetrics struct {
TotalRequests int64 `json:"total_requests"`
AllowedRequests int64 `json:"allowed_requests"`
DeniedRequests int64 `json:"denied_requests"`
ActiveKeys int64 `json:"active_keys"`
RedisOperations int64 `json:"redis_operations"`
RedisErrors int64 `json:"redis_errors"`
AverageLatency time.Duration `json:"average_latency"`
AllowRate float64 `json:"allow_rate"`
}
RateLimitMetrics tracks rate limiting performance
type RateLimitRequest ¶ added in v0.2.0
type RateLimitRequest struct {
Key string `json:"key"`
Limit int64 `json:"limit"`
Window time.Duration `json:"window"`
Burst int64 `json:"burst"`
Cost int64 `json:"cost"`
Timestamp time.Time `json:"timestamp"`
}
RateLimitRequest represents a rate limit check request
type RateLimitResult ¶ added in v0.2.0
type RateLimitResult struct {
Allowed bool `json:"allowed"`
Remaining int64 `json:"remaining"`
ResetTime time.Time `json:"reset_time"`
RetryAfter time.Duration `json:"retry_after"`
TotalLimit int64 `json:"total_limit"`
WindowSize time.Duration `json:"window_size"`
CurrentUsage int64 `json:"current_usage"`
}
RateLimitResult represents the result of a rate limit check
type RateLimitScripts ¶ added in v0.2.0
type RateLimitScripts struct {
TokenBucket *redis.Script
SlidingWindow *redis.Script
FixedWindow *redis.Script
LeakyBucket *redis.Script
Cleanup *redis.Script
}
RateLimitScripts contains Lua scripts for atomic Redis operations
type ReadPreference ¶ added in v0.2.0
type ReadPreference string
ReadPreference defines read preference for cache operations
const ( ReadPrimary ReadPreference = "primary" ReadReplica ReadPreference = "replica" ReadNearest ReadPreference = "nearest" ReadPreferReplica ReadPreference = "prefer_replica" )
type RedisClusterCache ¶ added in v0.2.0
type RedisClusterCache struct {
// contains filtered or unexported fields
}
RedisClusterCache provides advanced caching with Redis clustering support
func NewRedisClusterCache ¶ added in v0.2.0
func NewRedisClusterCache(config RedisClusterCacheConfig, logger Logger) (*RedisClusterCache, error)
NewRedisClusterCache creates a new Redis cluster cache
func (*RedisClusterCache) Delete ¶ added in v0.2.0
func (c *RedisClusterCache) Delete(key string) error
Delete removes a value from the cache
func (*RedisClusterCache) Get ¶ added in v0.2.0
func (c *RedisClusterCache) Get(key string) (interface{}, error)
Get retrieves a value from the cache
func (*RedisClusterCache) GetMetrics ¶ added in v0.2.0
func (c *RedisClusterCache) GetMetrics() *CacheMetrics
GetMetrics returns cache metrics
func (*RedisClusterCache) InvalidateByTags ¶ added in v0.2.0
func (c *RedisClusterCache) InvalidateByTags(tags []string) error
InvalidateByTags invalidates all entries with the specified tags
func (*RedisClusterCache) Set ¶ added in v0.2.0
func (c *RedisClusterCache) Set(key string, value interface{}, ttl time.Duration, tags ...string) error
Set stores a value in the cache
func (*RedisClusterCache) Start ¶ added in v0.2.0
func (c *RedisClusterCache) Start() error
Start starts the Redis cluster cache
func (*RedisClusterCache) Stop ¶ added in v0.2.0
func (c *RedisClusterCache) Stop() error
Stop stops the Redis cluster cache
type RedisClusterCacheConfig ¶ added in v0.2.0
type RedisClusterCacheConfig struct {
// Cluster configuration
PrimaryAddrs []string `json:"primary_addrs"`
ReplicaAddrs []string `json:"replica_addrs"`
Password string `json:"password"`
MaxRedirects int `json:"max_redirects"`
ReadTimeout time.Duration `json:"read_timeout"`
WriteTimeout time.Duration `json:"write_timeout"`
// Partitioning strategy
PartitionStrategy PartitionStrategy `json:"partition_strategy"`
PartitionCount int `json:"partition_count"`
ReplicationFactor int `json:"replication_factor"`
ConsistentHashing bool `json:"consistent_hashing"`
// Cache settings
DefaultTTL time.Duration `json:"default_ttl"`
MaxValueSize int64 `json:"max_value_size"`
CompressionEnabled bool `json:"compression_enabled"`
CompressionThreshold int64 `json:"compression_threshold"`
// Invalidation settings
InvalidationStrategy InvalidationStrategy `json:"invalidation_strategy"`
TagsEnabled bool `json:"tags_enabled"`
MaxTags int `json:"max_tags"`
// Cache warming
WarmingEnabled bool `json:"warming_enabled"`
WarmingInterval time.Duration `json:"warming_interval"`
WarmingConcurrency int `json:"warming_concurrency"`
WarmingBatchSize int `json:"warming_batch_size"`
// Performance optimization
PipelineSize int `json:"pipeline_size"`
PoolSize int `json:"pool_size"`
MinIdleConns int `json:"min_idle_conns"`
ReadPreference ReadPreference `json:"read_preference"`
// Monitoring
EnableMetrics bool `json:"enable_metrics"`
MetricsInterval time.Duration `json:"metrics_interval"`
EnableTracing bool `json:"enable_tracing"`
}
RedisClusterCacheConfig defines configuration for Redis cluster caching
func DefaultRedisClusterCacheConfig ¶ added in v0.2.0
func DefaultRedisClusterCacheConfig() RedisClusterCacheConfig
DefaultRedisClusterCacheConfig returns default configuration
type ReportExporter ¶ added in v0.2.0
type ReportExporter interface {
Export(report []byte, format string, destination string) error
GetName() string
}
ReportExporter exports reports to different destinations
type ReportPeriod ¶ added in v0.2.0
ReportPeriod defines the time period for reports
type ReportTemplate ¶ added in v0.2.0
type ReportTemplate interface {
Generate(data *PerformanceReport) ([]byte, error)
GetFormat() string
GetName() string
}
ReportTemplate defines report templates
type ReporterConfig ¶ added in v0.2.0
type ReporterMetrics ¶ added in v0.2.0
type ResourceStats ¶ added in v0.2.0
type ScalingCondition ¶ added in v0.2.0
type ScalingCondition struct {
Metric string `json:"metric"`
Operator ThresholdOperator `json:"operator"`
Value float64 `json:"value"`
Duration time.Duration `json:"duration"`
}
ScalingCondition defines additional scaling conditions
type ScalingEvent ¶ added in v0.2.0
type ScalingHistory ¶ added in v0.2.0
type ScalingHistory struct {
Events []ScalingEvent `json:"events"`
// contains filtered or unexported fields
}
Data structures
type ScalingMetrics ¶ added in v0.2.0
type ScalingPolicy ¶ added in v0.2.0
type ScalingPolicy struct {
Name string `json:"name"`
Type ScalingType `json:"type"`
Metric string `json:"metric"`
Threshold float64 `json:"threshold"`
Operator ThresholdOperator `json:"operator"`
ScaleAmount int `json:"scale_amount"`
Cooldown time.Duration `json:"cooldown"`
Priority int `json:"priority"`
Conditions []ScalingCondition `json:"conditions"`
}
ScalingPolicy defines scaling behavior
type ScalingTrigger ¶ added in v0.2.0
type ScalingTrigger struct {
Policy *ScalingPolicy `json:"policy"`
LastTrigger time.Time `json:"last_trigger"`
Active bool `json:"active"`
}
type ScalingType ¶ added in v0.2.0
type ScalingType string
ScalingType defines scaling types
const ( ScalingTypeUp ScalingType = "scale_up" ScalingTypeDown ScalingType = "scale_down" ScalingTypePredictive ScalingType = "predictive" ScalingTypeScheduled ScalingType = "scheduled" )
type SchedulerConfig ¶ added in v0.2.0
type SchedulerConfig struct {
Algorithm SchedulingAlgorithm `json:"algorithm"`
PriorityLevels int `json:"priority_levels"`
QueueTimeout time.Duration `json:"queue_timeout"`
EnablePreemption bool `json:"enable_preemption"`
}
type SchedulerMetrics ¶ added in v0.2.0
type SchedulingAlgorithm ¶ added in v0.2.0
type SchedulingAlgorithm string
SchedulingAlgorithm defines task scheduling algorithms
const ( SchedulingFIFO SchedulingAlgorithm = "fifo" SchedulingPriority SchedulingAlgorithm = "priority" SchedulingRoundRobin SchedulingAlgorithm = "round_robin" SchedulingLeastLoad SchedulingAlgorithm = "least_load" SchedulingAdaptive SchedulingAlgorithm = "adaptive" )
type ServiceDiscovery ¶ added in v0.2.0
type ServiceDiscovery struct {
// contains filtered or unexported fields
}
type StageMetrics ¶ added in v0.2.0
type StageProcessor ¶ added in v0.2.0
type StageProcessor interface {
ProcessStage(ctx context.Context, task Task) (Task, error)
GetStageName() string
IsParallel() bool
}
StageProcessor processes tasks in a pipeline stage
type StageWorker ¶ added in v0.2.0
type StageWorker struct {
// contains filtered or unexported fields
}
type StringBuilderFactory ¶ added in v0.2.0
type StringBuilderFactory struct{}
StringBuilderFactory creates string builder pools
func (*StringBuilderFactory) CreateObject ¶ added in v0.2.0
func (f *StringBuilderFactory) CreateObject() interface{}
func (*StringBuilderFactory) GetObjectType ¶ added in v0.2.0
func (f *StringBuilderFactory) GetObjectType() string
type StringBuilderReset ¶ added in v0.2.0
type StringBuilderReset struct{}
StringBuilderReset resets string builders
func (*StringBuilderReset) ResetObject ¶ added in v0.2.0
func (r *StringBuilderReset) ResetObject(obj interface{}) error
type TagIndex ¶ added in v0.2.0
type TagIndex struct {
// contains filtered or unexported fields
}
TagIndex maintains an index of cache entries by tags
type TargetHealthStatus ¶ added in v0.2.0
type TargetHealthStatus string
TargetHealthStatus represents target health states
const ( TargetHealthy TargetHealthStatus = "healthy" TargetDegraded TargetHealthStatus = "degraded" TargetUnhealthy TargetHealthStatus = "unhealthy" TargetMaintenance TargetHealthStatus = "maintenance" TargetUnknown TargetHealthStatus = "unknown" )
type TargetStatistics ¶ added in v0.2.0
type TargetStatistics struct {
TotalRequests int64 `json:"total_requests"`
SuccessfulRequests int64 `json:"successful_requests"`
FailedRequests int64 `json:"failed_requests"`
AverageLatency time.Duration `json:"average_latency"`
P95Latency time.Duration `json:"p95_latency"`
P99Latency time.Duration `json:"p99_latency"`
Throughput float64 `json:"throughput"`
ErrorRate float64 `json:"error_rate"`
SuccessRate float64 `json:"success_rate"`
LastUpdated time.Time `json:"last_updated"`
LatencyHistory []time.Duration `json:"latency_history"`
}
TargetStatistics tracks detailed target performance
type Task ¶
type Task interface {
GetID() string
GetType() string
GetPriority() int
GetTimeout() time.Duration
Execute(ctx context.Context) (interface{}, error)
OnComplete(result interface{}, err error)
OnCancel()
}
Task represents a unit of work
type TaskProcessor ¶ added in v0.2.0
type TaskProcessor interface {
CanProcess(task Task) bool
Process(ctx context.Context, task Task) (interface{}, error)
GetCapacity() int
GetLoad() float64
}
TaskProcessor processes specific types of tasks
type TaskScheduler ¶ added in v0.2.0
type TaskScheduler struct {
// contains filtered or unexported fields
}
TaskScheduler schedules tasks across workers and pools
func NewTaskScheduler ¶ added in v0.2.0
func NewTaskScheduler(config SchedulerConfig, coordinator *WorkerCoordinator, logger Logger) *TaskScheduler
func (*TaskScheduler) ScheduleTask ¶ added in v0.2.0
func (ts *TaskScheduler) ScheduleTask(task Task) error
func (*TaskScheduler) Start ¶ added in v0.2.0
func (ts *TaskScheduler) Start() error
func (*TaskScheduler) Stop ¶ added in v0.2.0
func (ts *TaskScheduler) Stop() error
type ThresholdOperator ¶ added in v0.2.0
type ThresholdOperator string
ThresholdOperator defines threshold comparison operators
const ( OperatorGreaterThan ThresholdOperator = "gt" OperatorLessThan ThresholdOperator = "lt" OperatorGreaterEqual ThresholdOperator = "gte" OperatorLessEqual ThresholdOperator = "lte" OperatorEqual ThresholdOperator = "eq" OperatorNotEqual ThresholdOperator = "ne" )
type TraceProfiler ¶ added in v0.2.0
type TraceProfiler struct {
// contains filtered or unexported fields
}
func (*TraceProfiler) Collect ¶ added in v0.2.0
func (tp *TraceProfiler) Collect() (*ProfileData, error)
func (*TraceProfiler) GetName ¶ added in v0.2.0
func (tp *TraceProfiler) GetName() string
func (*TraceProfiler) IsEnabled ¶ added in v0.2.0
func (tp *TraceProfiler) IsEnabled() bool
func (*TraceProfiler) Start ¶ added in v0.2.0
func (tp *TraceProfiler) Start() error
func (*TraceProfiler) Stop ¶ added in v0.2.0
func (tp *TraceProfiler) Stop() error
type Trend ¶ added in v0.2.0
type Trend struct {
Direction TrendDirection `json:"direction"`
Magnitude float64 `json:"magnitude"`
Confidence float64 `json:"confidence"`
DataPoints []DataPoint `json:"data_points"`
}
Trend represents a performance trend
type TrendAnalysis ¶ added in v0.2.0
type TrendAnalysis struct {
CPUTrend *Trend `json:"cpu_trend"`
MemoryTrend *Trend `json:"memory_trend"`
LatencyTrend *Trend `json:"latency_trend"`
ThroughputTrend *Trend `json:"throughput_trend"`
LastUpdated time.Time `json:"last_updated"`
}
TrendAnalysis analyzes performance trends over time
type TrendDirection ¶
type TrendDirection string
TrendDirection defines trend directions
const ( TrendImproving TrendDirection = "improving" TrendStable TrendDirection = "stable" TrendDegrading TrendDirection = "degrading" )
type WarmerMetrics ¶ added in v0.2.0
type WarmingExecutor ¶ added in v0.2.0
type WarmingExecutor struct {
// contains filtered or unexported fields
}
type WarmingJob ¶ added in v0.2.0
type WarmingScheduler ¶ added in v0.2.0
type WarmingScheduler struct {
// contains filtered or unexported fields
}
type WarmingStrategy ¶ added in v0.2.0
type WarmingStrategy interface {
ShouldWarm(key string, entry *CacheEntry) bool
GetPriority(key string, entry *CacheEntry) int
GetWarmingData(key string) (interface{}, error)
}
WarmingStrategy defines cache warming strategies
type WarmingWorker ¶ added in v0.2.0
type WarmingWorker struct {
// contains filtered or unexported fields
}
type WeightAlgorithm ¶ added in v0.2.0
type WeightAlgorithm string
const ( WeightStatic WeightAlgorithm = "static" WeightDynamic WeightAlgorithm = "dynamic" WeightAdaptive WeightAlgorithm = "adaptive" WeightMLBased WeightAlgorithm = "ml_based" )
type WeightConfig ¶ added in v0.2.0
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker represents an individual worker
type WorkerCoordinator ¶ added in v0.2.0
type WorkerCoordinator struct {
// contains filtered or unexported fields
}
WorkerCoordinator coordinates workers across pools and nodes
func NewWorkerCoordinator ¶ added in v0.2.0
func NewWorkerCoordinator(config CoordinatorConfig, logger Logger) *WorkerCoordinator
Placeholder implementations for missing functions
func (*WorkerCoordinator) Start ¶ added in v0.2.0
func (wc *WorkerCoordinator) Start() error
func (*WorkerCoordinator) Stop ¶ added in v0.2.0
func (wc *WorkerCoordinator) Stop() error
type WorkerMetrics ¶ added in v0.2.0
type WorkerMetrics struct {
WorkerID string `json:"worker_id"`
TasksProcessed int64 `json:"tasks_processed"`
TasksFailed int64 `json:"tasks_failed"`
AverageLatency time.Duration `json:"average_latency"`
LastTaskTime time.Time `json:"last_task_time"`
Status WorkerStatus `json:"status"`
Load float64 `json:"load"`
}
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool manages a pool of workers for specific task types
func NewWorkerPool ¶
func NewWorkerPool(config WorkerPoolConfig, processor TaskProcessor, coordinator *WorkerCoordinator, logger Logger) *WorkerPool
func (*WorkerPool) AddWorker ¶ added in v0.2.0
func (wp *WorkerPool) AddWorker() error
func (*WorkerPool) GetMetrics ¶
func (wp *WorkerPool) GetMetrics() *PoolMetrics
func (*WorkerPool) RemoveWorker ¶ added in v0.2.0
func (wp *WorkerPool) RemoveWorker() error
func (*WorkerPool) Start ¶
func (wp *WorkerPool) Start() error
func (*WorkerPool) Stop ¶
func (wp *WorkerPool) Stop() error
type WorkerPoolConfig ¶
type WorkerPoolConfig struct {
Name string `json:"name"`
MinWorkers int `json:"min_workers"`
MaxWorkers int `json:"max_workers"`
QueueSize int `json:"queue_size"`
TaskTimeout time.Duration `json:"task_timeout"`
IdleTimeout time.Duration `json:"idle_timeout"`
ScalingInterval time.Duration `json:"scaling_interval"`
}
Configuration structures
type WorkerStatus ¶ added in v0.2.0
type WorkerStatus string
WorkerStatus represents worker states
const ( WorkerStatusIdle WorkerStatus = "idle" WorkerStatusProcessing WorkerStatus = "processing" WorkerStatusStopped WorkerStatus = "stopped" WorkerStatusError WorkerStatus = "error" )