performance

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessPattern added in v0.2.0

type AccessPattern struct {
	Key           string      `json:"key"`
	AccessTimes   []time.Time `json:"access_times"`
	Frequency     float64     `json:"frequency"`
	LastAccess    time.Time   `json:"last_access"`
	PredictedNext time.Time   `json:"predicted_next"`
}

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 AlertChannel interface {
	Send(alert *Alert) error
	GetName() string
}

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 AlertConfig struct {
	CheckInterval   time.Duration `json:"check_interval"`
	MaxAlerts       int           `json:"max_alerts"`
	AlertRetention  time.Duration `json:"alert_retention"`
	DefaultChannels []string      `json:"default_channels"`
}

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 AlertMetrics struct {
	AlertsTriggered int64         `json:"alerts_triggered"`
	AlertsResolved  int64         `json:"alerts_resolved"`
	FalsePositives  int64         `json:"false_positives"`
	ResponseTime    time.Duration `json:"response_time"`
}

type AlertRule

type AlertRule struct {
	Name      string                 `json:"name"`
	Condition AlertCondition         `json:"condition"`
	Threshold float64                `json:"threshold"`
	Duration  time.Duration          `json:"duration"`
	Severity  Severity               `json:"severity"`
	Enabled   bool                   `json:"enabled"`
	Metadata  map[string]interface{} `json:"metadata"`
}

type AnalyzerConfig added in v0.2.0

type AnalyzerConfig struct {
	HotspotThreshold    float64       `json:"hotspot_threshold"`
	IssueDetectionDepth int           `json:"issue_detection_depth"`
	TrendWindowSize     int           `json:"trend_window_size"`
	AnalysisInterval    time.Duration `json:"analysis_interval"`
}

type AnalyzerMetrics added in v0.2.0

type AnalyzerMetrics struct {
	HotspotsDetected int64   `json:"hotspots_detected"`
	IssuesFound      int64   `json:"issues_found"`
	TrendsAnalyzed   int64   `json:"trends_analyzed"`
	AnalysisAccuracy float64 `json:"analysis_accuracy"`
}

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 BalanceTarget struct {
	ID      string  `json:"id"`
	Address string  `json:"address"`
	Weight  int     `json:"weight"`
	Active  bool    `json:"active"`
	Load    float64 `json:"load"`
}

type BalancerConfig added in v0.2.0

type BalancerConfig struct {
	Strategy            BalancingStrategy `json:"strategy"`
	HealthCheckInterval time.Duration     `json:"health_check_interval"`
	FailureThreshold    int               `json:"failure_threshold"`
	RecoveryTimeout     time.Duration     `json:"recovery_timeout"`
}

type BalancerMetrics added in v0.2.0

type BalancerMetrics struct {
	RequestsBalanced int64 `json:"requests_balanced"`
	ActiveTargets    int   `json:"active_targets"`
}

type BalancingStrategy added in v0.2.0

type BalancingStrategy string

BalancingStrategy defines the load balancing strategy

const (
	BalancingRoundRobin  BalancingStrategy = "round_robin"
	BalancingLeastActive BalancingStrategy = "least_active"
	BalancingWeighted    BalancingStrategy = "weighted"
	BalancingConsistent  BalancingStrategy = "consistent"
	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 BenchmarkConfig struct {
	Iterations   int           `json:"iterations"`
	Duration     time.Duration `json:"duration"`
	Parallel     bool          `json:"parallel"`
	WarmupRounds int           `json:"warmup_rounds"`
}

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 CacheSchedulerMetrics struct {
	JobsQueued    int64 `json:"jobs_queued"`
	JobsProcessed int64 `json:"jobs_processed"`
	QueueDepth    int   `json:"queue_depth"`
}

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 CircuitBreakerMetrics struct {
	TotalRequests int64 `json:"total_requests"`
	OpenCircuits  int   `json:"open_circuits"`
	TrippedEvents int64 `json:"tripped_events"`
}

type CircuitBreakerSettings added in v0.2.0

type CircuitBreakerSettings struct {
	FailureThreshold int           `json:"failure_threshold"`
	RecoveryTimeout  time.Duration `json:"recovery_timeout"`
	HalfOpenRequests int           `json:"half_open_requests"`
}

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

func (*ConcurrencyEngine) CreatePipeline

func (e *ConcurrencyEngine) CreatePipeline(config PipelineConfig, stages []StageProcessor) (*ExecutionPipeline, error)

func (*ConcurrencyEngine) CreateWorkerPool added in v0.2.0

func (e *ConcurrencyEngine) CreateWorkerPool(config WorkerPoolConfig, processor TaskProcessor) (*WorkerPool, error)

func (*ConcurrencyEngine) GetMetrics

func (e *ConcurrencyEngine) GetMetrics() *ConcurrencyMetrics

func (*ConcurrencyEngine) Start

func (e *ConcurrencyEngine) Start() error

func (*ConcurrencyEngine) Stop

func (e *ConcurrencyEngine) Stop() error

func (*ConcurrencyEngine) SubmitTask added in v0.2.0

func (e *ConcurrencyEngine) SubmitTask(task Task) error

func (*ConcurrencyEngine) SubmitTasks added in v0.2.0

func (e *ConcurrencyEngine) SubmitTasks(tasks []Task) error

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 CoordinatorConfig struct {
	NodeID            string        `json:"node_id"`
	HeartbeatInterval time.Duration `json:"heartbeat_interval"`
	NodeTimeout       time.Duration `json:"node_timeout"`
	EnableDiscovery   bool          `json:"enable_discovery"`
	DiscoveryInterval time.Duration `json:"discovery_interval"`
}

type CoordinatorMetrics added in v0.2.0

type CoordinatorMetrics struct {
	ActiveNodes int `json:"active_nodes"`
	TotalNodes  int `json:"total_nodes"`
}

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 DataPoint added in v0.2.0

type DataPoint struct {
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
}

DataPoint represents a single data point in a trend

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 DiskMetrics struct {
	BytesRead    int64   `json:"bytes_read"`
	BytesWritten int64   `json:"bytes_written"`
	ReadOps      int64   `json:"read_ops"`
	WriteOps     int64   `json:"write_ops"`
	Usage        float64 `json:"usage"`
}

type DistributedRateLimitConfig added in v0.2.0

type DistributedRateLimitConfig struct {
	// Redis connection
	RedisAddr     string `json:"redis_addr"`
	RedisPassword string `json:"redis_password"` // #nosec G101 -- not a hardcoded credential; this is a config struct field for Redis connection settings
	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

Allow checks if a request is allowed under the rate limit

func (*DistributedRateLimiter) AllowN added in v0.2.0

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
}

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 ExecutorMetrics struct {
	JobsExecuted  int64         `json:"jobs_executed"`
	ExecutionTime time.Duration `json:"execution_time"`
	SuccessRate   float64       `json:"success_rate"`
}

type GCMetrics added in v0.2.0

type GCMetrics struct {
	NumGC         uint32        `json:"num_gc"`
	NumForcedGC   uint32        `json:"num_forced_gc"`
	PauseTotal    time.Duration `json:"pause_total"`
	PauseNs       []uint64      `json:"pause_ns"`
	LastGC        time.Time     `json:"last_gc"`
	GCCPUFraction float64       `json:"gc_cpu_fraction"`
}

type GCStats added in v0.2.0

type GCStats struct {
	NumGC       uint32        `json:"num_gc"`
	PauseTotal  time.Duration `json:"pause_total"`
	LastPause   time.Duration `json:"last_pause"`
	HeapSize    uint64        `json:"heap_size"`
	HeapObjects uint64        `json:"heap_objects"`
}

type GoroutineMetrics added in v0.2.0

type GoroutineMetrics struct {
	Count        int   `json:"count"`
	MaxCreated   int64 `json:"max_created"`
	TotalCreated int64 `json:"total_created"`
	Blocked      int   `json:"blocked"`
	Running      int   `json:"running"`
	Waiting      int   `json:"waiting"`
}

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 InvalidatorMetrics struct {
	Invalidations    int64 `json:"invalidations"`
	TagInvalidations int64 `json:"tag_invalidations"`
	TTLExpired       int64 `json:"ttl_expired"`
	ManualEvictions  int64 `json:"manual_evictions"`
}

type IssueType added in v0.2.0

type IssueType string

IssueType defines types of performance issues

const (
	IssueTypeCPU           IssueType = "cpu"
	IssueTypeMemory        IssueType = "memory"
	IssueTypeGoroutineLeak IssueType = "goroutine_leak"
	IssueTypeDeadlock      IssueType = "deadlock"
	IssueTypeGC            IssueType = "gc"
	IssueTypeLatency       IssueType = "latency"
	IssueTypeThroughput    IssueType = "throughput"
)

type KeyRange added in v0.2.0

type KeyRange struct {
	Start uint32 `json:"start"`
	End   uint32 `json:"end"`
}

KeyRange defines a range of keys for partitioning

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 LoadBalancerDataPoint struct {
	Timestamp time.Time          `json:"timestamp"`
	Value     float64            `json:"value"`
	Features  map[string]float64 `json:"features"`
}

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 LoadDataPoint struct {
	Timestamp time.Time     `json:"timestamp"`
	Load      float64       `json:"load"`
	Targets   int           `json:"targets"`
	Latency   time.Duration `json:"latency"`
}

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 performance package logging operations

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

func (r *MapReset) ResetObject(obj interface{}) error

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 NetworkMetrics struct {
	BytesSent       int64 `json:"bytes_sent"`
	BytesReceived   int64 `json:"bytes_received"`
	PacketsSent     int64 `json:"packets_sent"`
	PacketsReceived int64 `json:"packets_received"`
	Connections     int   `json:"connections"`
}

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"
	NodeStatusUnavailable NodeStatus = "unavailable"
)

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

func (*ObjectPool) Stop added in v0.2.0

func (p *ObjectPool) Stop()

Stop stops the object 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 OptimizerMetrics struct {
	OptimizationsAttempted  int64     `json:"optimizations_attempted"`
	OptimizationsSuccessful int64     `json:"optimizations_successful"`
	PerformanceImprovement  float64   `json:"performance_improvement"`
	LastOptimization        time.Time `json:"last_optimization"`
}

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 PartitionerMetrics struct {
	Rebalances   int64   `json:"rebalances"`
	Migrations   int64   `json:"migrations"`
	LoadVariance float64 `json:"load_variance"`
}

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 PipelineConfig struct {
	Name           string        `json:"name"`
	BufferSize     int           `json:"buffer_size"`
	Timeout        time.Duration `json:"timeout"`
	EnableParallel bool          `json:"enable_parallel"`
	MaxConcurrency int           `json:"max_concurrency"`
}

type PipelineMetrics added in v0.2.0

type PipelineMetrics struct {
	TasksProcessed int64         `json:"tasks_processed"`
	AverageLatency time.Duration `json:"average_latency"`
}

type PipelineResult added in v0.2.0

type PipelineResult struct {
	TaskID string      `json:"task_id"`
	Result interface{} `json:"result"`
	Error  error       `json:"error"`
}

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 PredictionMetrics struct {
	PredictionAccuracy float64       `json:"prediction_accuracy"`
	ModelConfidence    float64       `json:"model_confidence"`
	LastUpdate         time.Time     `json:"last_update"`
	PredictionLatency  time.Duration `json:"prediction_latency"`
}

type PredictionModel added in v0.2.0

type PredictionModel struct {
	Algorithm    PredictionAlgorithm `json:"algorithm"`
	Parameters   map[string]float64  `json:"parameters"`
	Accuracy     float64             `json:"accuracy"`
	LastTrained  time.Time           `json:"last_trained"`
	TrainingData []DataPoint         `json:"training_data"`
}

type PredictionPoint added in v0.2.0

type PredictionPoint struct {
	Timestamp  time.Time `json:"timestamp"`
	Value      float64   `json:"value"`
	Confidence float64   `json:"confidence"`
}

type PredictorConfig added in v0.2.0

type PredictorConfig struct {
	WindowSize        int           `json:"window_size"`
	MinDataPoints     int           `json:"min_data_points"`
	PredictionHorizon time.Duration `json:"prediction_horizon"`
}

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 NewBlockProfiler(dir string, logger Logger) Profiler

func NewCPUProfiler added in v0.2.0

func NewCPUProfiler(dir string, logger Logger) Profiler

Individual profiler implementations

func NewGoroutineProfiler added in v0.2.0

func NewGoroutineProfiler(dir string, logger Logger) Profiler

func NewMemoryProfiler

func NewMemoryProfiler(dir string, logger Logger) Profiler

func NewMutexProfiler added in v0.2.0

func NewMutexProfiler(dir string, logger Logger) Profiler

func NewTraceProfiler added in v0.2.0

func NewTraceProfiler(dir string, logger Logger) Profiler

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

type ReportPeriod struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

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 ReporterConfig struct {
	ReportInterval     time.Duration `json:"report_interval"`
	ReportFormats      []string      `json:"report_formats"`
	ExportDestinations []string      `json:"export_destinations"`
	HistoryRetention   time.Duration `json:"history_retention"`
}

type ReporterMetrics added in v0.2.0

type ReporterMetrics struct {
	ReportsGenerated int64 `json:"reports_generated"`
	ReportsExported  int64 `json:"reports_exported"`
	ExportFailures   int64 `json:"export_failures"`
}

type ResourceStats added in v0.2.0

type ResourceStats struct {
	CPUUsage    float64 `json:"cpu_usage"`
	MemoryUsage float64 `json:"memory_usage"`
	Goroutines  int     `json:"goroutines"`
	GCStats     GCStats `json:"gc_stats"`
}

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 ScalingEvent struct {
	Timestamp   time.Time          `json:"timestamp"`
	Type        ScalingType        `json:"type"`
	Reason      string             `json:"reason"`
	TargetCount int                `json:"target_count"`
	Metrics     map[string]float64 `json:"metrics"`
}

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 ScalingMetrics struct {
	ScaleUpEvents      int64   `json:"scale_up_events"`
	ScaleDownEvents    int64   `json:"scale_down_events"`
	CurrentTargets     int     `json:"current_targets"`
	PredictionAccuracy float64 `json:"prediction_accuracy"`
}

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 SchedulerMetrics struct {
	TasksScheduled int64 `json:"tasks_scheduled"`
	QueueDepth     int   `json:"queue_depth"`
}

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 Severity added in v0.2.0

type Severity string

Severity defines issue severity levels

const (
	SeverityLow      Severity = "low"
	SeverityMedium   Severity = "medium"
	SeverityHigh     Severity = "high"
	SeverityCritical Severity = "critical"
)

type StageMetrics added in v0.2.0

type StageMetrics struct {
	StageName      string        `json:"stage_name"`
	TasksProcessed int64         `json:"tasks_processed"`
	AverageLatency time.Duration `json:"average_latency"`
}

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

func (*TagIndex) AddTags added in v0.2.0

func (ti *TagIndex) AddTags(key string, tags []string)

func (*TagIndex) RemoveKey added in v0.2.0

func (ti *TagIndex) RemoveKey(key string)

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
}

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 WarmerMetrics struct {
	WarmingJobs      int64         `json:"warming_jobs"`
	JobsCompleted    int64         `json:"jobs_completed"`
	JobsFailed       int64         `json:"jobs_failed"`
	AverageWarmTime  time.Duration `json:"average_warm_time"`
	CacheHitIncrease float64       `json:"cache_hit_increase"`
}

type WarmingExecutor added in v0.2.0

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

type WarmingJob added in v0.2.0

type WarmingJob struct {
	Key      string    `json:"key"`
	Priority int       `json:"priority"`
	Strategy string    `json:"strategy"`
	Created  time.Time `json:"created"`
}

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 WeightConfig struct {
	Algorithm          WeightAlgorithm `json:"algorithm"`
	UpdateInterval     time.Duration   `json:"update_interval"`
	ResponseTimeFactor float64         `json:"response_time_factor"`
	ErrorRateFactor    float64         `json:"error_rate_factor"`
	LoadFactor         float64         `json:"load_factor"`
}

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
}

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"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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