daemon

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package daemon contiene la lógica del servicio de Windows.

Index

Constants

This section is empty.

Variables

View Source
var (
	BuildEnvironment = "prod"
	BuildDate        = "unknown"
	BuildTime        = "unknown"
)

Build variables, injected at compile time

Functions

func FlushLogFile

func FlushLogFile() error

FlushLogFile keeps last 50 lines and clears the rest

func GetLogFileSize

func GetLogFileSize() int64

GetLogFileSize returns current log file size

func GetVerbose

func GetVerbose() bool

GetVerbose returns current verbosity level

func InitLogger

func InitLogger(path string, verbose bool) error

InitLogger initializes the file logger with rotation

func SetVerbose

func SetVerbose(v bool)

SetVerbose changes the verbosity level at runtime

Types

type BuildInfo

type BuildInfo struct {
	Env  string `json:"env"`
	Date string `json:"date"`
	Time string `json:"time"`
}

BuildInfo contiene información sobre la compilación del servicio.

type EnvironmentConfig

type EnvironmentConfig struct {
	// Identificación
	Name        string
	ServiceName string

	// Red
	ListenAddr   string
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	IdleTimeout  time.Duration

	// Cola
	QueueCapacity int

	// Logging
	Verbose bool

	// Impresora
	DefaultPrinter string
}

EnvironmentConfig holds ALL environment-specific configuration

func GetEnvConfig

func GetEnvConfig() EnvironmentConfig

GetEnvConfig returns the current environment configuration

type FilteredLogger

type FilteredLogger struct{}

FilteredLogger implements io.Writer with filtering

func (*FilteredLogger) Write

func (l *FilteredLogger) Write(p []byte) (n int, err error)

Write filters log messages based on verbosity

type HealthResponse

type HealthResponse struct {
	Status   string          `json:"status"`
	Queue    QueueStatus     `json:"queue"`
	Worker   WorkerStatus    `json:"worker"`
	Printers printer.Summary `json:"printers"` // NEW
	Build    BuildInfo       `json:"build"`
	Uptime   int             `json:"uptime_seconds"`
}

HealthResponse representa el estado de salud del servicio de impresión.

type PrinterDiscovery

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

PrinterDiscovery handles printer enumeration with caching

func NewPrinterDiscovery

func NewPrinterDiscovery() *PrinterDiscovery

NewPrinterDiscovery creates a new discovery service

func (*PrinterDiscovery) GetPrinters

func (pd *PrinterDiscovery) GetPrinters(forceRefresh bool) ([]connection.PrinterDetail, error)

GetPrinters returns cached printers or refreshes if stale

func (*PrinterDiscovery) GetSummary

func (pd *PrinterDiscovery) GetSummary() printer.Summary

GetSummary returns a lightweight summary for health checks

func (*PrinterDiscovery) LogStartupDiagnostics

func (pd *PrinterDiscovery) LogStartupDiagnostics()

LogStartupDiagnostics logs printer info at service start

type Program

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

Program implements svc.Service interface

func (*Program) Init

func (p *Program) Init(env svc.Environment) error

Init initializes the service

func (*Program) Start

func (p *Program) Start() error

Start starts the service

func (*Program) Stop

func (p *Program) Stop() error

Stop stops the service gracefully

type QueueStatus

type QueueStatus struct {
	Current     int     `json:"current"`
	Capacity    int     `json:"capacity"`
	Utilization float64 `json:"utilization"`
}

QueueStatus representa el estado de la cola de impresión.

type WorkerStatus

type WorkerStatus struct {
	Running       bool  `json:"running"`
	JobsProcessed int64 `json:"jobs_processed"`
	JobsFailed    int64 `json:"jobs_failed"`
}

WorkerStatus representa el estado del trabajador de impresión.

Jump to

Keyboard shortcuts

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