Documentation
¶
Index ¶
- func CalculatePriority(info os.FileInfo) int
- func DetectServiceManager() string
- func GetAlreadyRunningHelp() string
- func GetNotRunningHelp() string
- func GetServiceManagerHint(sm string) string
- func GetSignalErrorHelp(pid int) string
- func IsServiceManaged() bool
- func StartHealthCheckServer(port int, metrics *HealthMetrics) error
- type Daemon
- func (d *Daemon) GetConfig() *config.Config
- func (d *Daemon) GetLogger() *slog.Logger
- func (d *Daemon) GetSemanticAnalyzer() *semantic.Analyzer
- func (d *Daemon) Rebuild() error
- func (d *Daemon) ReloadConfig() error
- func (d *Daemon) SetConfig(cfg *config.Config)
- func (d *Daemon) SetLogger(l *slog.Logger)
- func (d *Daemon) SetSemanticAnalyzer(a *semantic.Analyzer)
- func (d *Daemon) Start() error
- func (d *Daemon) Stop()
- type HealthCheckHandler
- type HealthMetrics
- type HealthSnapshot
- type Job
- type JobResult
- type PoolStats
- type WorkerPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculatePriority ¶
CalculatePriority calculates job priority based on file modification time More recently modified files get higher priority
func DetectServiceManager ¶
func DetectServiceManager() string
DetectServiceManager returns the appropriate service manager for the platform
func GetAlreadyRunningHelp ¶
func GetAlreadyRunningHelp() string
GetAlreadyRunningHelp returns platform-specific help for "already running" errors
func GetNotRunningHelp ¶
func GetNotRunningHelp() string
GetNotRunningHelp returns platform-specific help for "not running" errors
func GetServiceManagerHint ¶
GetServiceManagerHint returns helpful hint for managing daemon as service
func GetSignalErrorHelp ¶
GetSignalErrorHelp returns platform-specific help for signal errors
func IsServiceManaged ¶
func IsServiceManaged() bool
IsServiceManaged attempts to detect if daemon is running under service manager
func StartHealthCheckServer ¶
func StartHealthCheckServer(port int, metrics *HealthMetrics) error
StartHealthCheckServer starts an HTTP server for health checks
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon manages background index computation
func (*Daemon) GetSemanticAnalyzer ¶
GetSemanticAnalyzer returns the current semantic analyzer (lock-free)
func (*Daemon) ReloadConfig ¶
ReloadConfig reloads configuration and applies changes
func (*Daemon) SetSemanticAnalyzer ¶
SetSemanticAnalyzer sets the semantic analyzer atomically (lock-free)
type HealthCheckHandler ¶
type HealthCheckHandler struct {
// contains filtered or unexported fields
}
HealthCheckHandler provides an HTTP health check endpoint
func NewHealthCheckHandler ¶
func NewHealthCheckHandler(metrics *HealthMetrics) *HealthCheckHandler
NewHealthCheckHandler creates a new health check HTTP handler
func (*HealthCheckHandler) ServeHTTP ¶
func (h *HealthCheckHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles health check requests
type HealthMetrics ¶
type HealthMetrics struct {
StartTime time.Time `json:"start_time"`
Uptime string `json:"uptime"`
UptimeSeconds int64 `json:"uptime_seconds"`
FilesProcessed int `json:"files_processed"`
APICalls int `json:"api_calls"`
CacheHits int `json:"cache_hits"`
Errors int `json:"errors"`
LastBuildTime time.Time `json:"last_build_time"`
LastBuildSuccess bool `json:"last_build_success"`
IndexFileCount int `json:"index_file_count"`
WatcherActive bool `json:"watcher_active"`
// contains filtered or unexported fields
}
HealthMetrics tracks daemon health statistics
func NewHealthMetrics ¶
func NewHealthMetrics() *HealthMetrics
NewHealthMetrics creates a new health metrics tracker
func (*HealthMetrics) GetSnapshot ¶
func (h *HealthMetrics) GetSnapshot() HealthSnapshot
GetSnapshot returns a snapshot of current metrics
func (*HealthMetrics) RecordBuild ¶
func (h *HealthMetrics) RecordBuild(filesProcessed, apiCalls, cacheHits, errors int, success bool)
RecordBuild records a build attempt
func (*HealthMetrics) RecordError ¶
func (h *HealthMetrics) RecordError()
RecordError increments the error counter
func (*HealthMetrics) SetIndexFileCount ¶
func (h *HealthMetrics) SetIndexFileCount(count int)
SetIndexFileCount updates the current index file count
func (*HealthMetrics) SetWatcherActive ¶
func (h *HealthMetrics) SetWatcherActive(active bool)
SetWatcherActive sets the watcher active status
type HealthSnapshot ¶
type HealthSnapshot struct {
StartTime time.Time `json:"start_time"`
Uptime string `json:"uptime"`
UptimeSeconds int64 `json:"uptime_seconds"`
FilesProcessed int `json:"files_processed"`
APICalls int `json:"api_calls"`
CacheHits int `json:"cache_hits"`
Errors int `json:"errors"`
LastBuildTime time.Time `json:"last_build_time"`
LastBuildSuccess bool `json:"last_build_success"`
IndexFileCount int `json:"index_file_count"`
WatcherActive bool `json:"watcher_active"`
}
HealthSnapshot represents a point-in-time snapshot of health metrics without the mutex, safe for copying and serialization
type JobResult ¶
type JobResult struct {
Entry types.IndexEntry
Error error
}
JobResult represents the result of processing a job
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool manages parallel file processing with rate limiting
func NewWorkerPool ¶
func NewWorkerPool( workers int, rateLimitPerMin int, metadataExtractor *metadata.Extractor, semanticAnalyzer *semantic.Analyzer, cacheManager *cache.Manager, logger *slog.Logger, ctx context.Context, ) *WorkerPool
NewWorkerPool creates a new worker pool
func (*WorkerPool) GetStats ¶
func (wp *WorkerPool) GetStats() PoolStats
GetStats returns current pool statistics
func (*WorkerPool) Results ¶
func (wp *WorkerPool) Results() <-chan JobResult
Results returns the result channel
func (*WorkerPool) SubmitBatch ¶
func (wp *WorkerPool) SubmitBatch(jobs []Job)
SubmitBatch submits multiple jobs, sorted by priority