Documentation
¶
Index ¶
- type ComprehensiveStatus
- type Daemon
- type DaemonConfigStatus
- type DaemonStatus
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) GetStatus() (*ComprehensiveStatus, error)
- func (m *Manager) InstallSystemService() error
- func (m *Manager) IsAutoStartNeeded() bool
- func (m *Manager) RemoveSystemService() error
- func (m *Manager) RestartDaemon() error
- func (m *Manager) SetupBackgroundSync() error
- func (m *Manager) StartDaemon() error
- func (m *Manager) StopDaemon() error
- func (m *Manager) TriggerAutoStart() error
- type PIDManager
- func (pm *PIDManager) CleanupStalePIDFile() error
- func (pm *PIDManager) GetPIDFile() string
- func (pm *PIDManager) GetStatus() (*PIDStatus, error)
- func (pm *PIDManager) IsProcessRunning(pid int) bool
- func (pm *PIDManager) IsRunning() bool
- func (pm *PIDManager) KillDaemon() error
- func (pm *PIDManager) ReadPID() (int, error)
- func (pm *PIDManager) RemovePID() error
- func (pm *PIDManager) ValidatePIDFile() error
- func (pm *PIDManager) WritePID() error
- type PIDStatus
- type ServiceManager
- func (sm *ServiceManager) CreateSystemService() error
- func (sm *ServiceManager) GetServiceStatus() (*ServiceStatus, error)
- func (sm *ServiceManager) IsSystemServiceInstalled() bool
- func (sm *ServiceManager) RemoveSystemService() error
- func (sm *ServiceManager) RestartSystemService() error
- func (sm *ServiceManager) StartSystemService() error
- func (sm *ServiceManager) StopSystemService() error
- type ServiceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComprehensiveStatus ¶
type ComprehensiveStatus struct {
Daemon *DaemonStatus `json:"daemon"`
Service *ServiceStatus `json:"service"`
Config *DaemonConfigStatus `json:"config"`
}
ComprehensiveStatus contains all daemon status information
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon represents the sync daemon process
func (*Daemon) GetStatus ¶
func (d *Daemon) GetStatus() *DaemonStatus
GetStatus returns the current daemon status
type DaemonConfigStatus ¶
type DaemonConfigStatus struct {
SyncInterval time.Duration `json:"sync_interval"`
AutoStart bool `json:"auto_start"`
SystemService bool `json:"system_service"`
PIDFile string `json:"pid_file"`
LogFile string `json:"log_file"`
LogLevel string `json:"log_level"`
}
DaemonConfigStatus contains daemon configuration information
type DaemonStatus ¶
type DaemonStatus struct {
Running bool `json:"running"`
PID int `json:"pid,omitempty"`
Uptime time.Duration `json:"uptime,omitempty"`
LastSync time.Time `json:"last_sync,omitempty"`
SyncCount int64 `json:"sync_count"`
ErrorCount int64 `json:"error_count"`
SyncInterval time.Duration `json:"sync_interval"`
AutoStart bool `json:"auto_start"`
SystemService bool `json:"system_service"`
}
DaemonStatus represents the current status of the daemon
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles daemon lifecycle and service management
func NewManager ¶
NewManager creates a new daemon manager instance
func (*Manager) GetStatus ¶
func (m *Manager) GetStatus() (*ComprehensiveStatus, error)
GetStatus returns comprehensive daemon status
func (*Manager) InstallSystemService ¶
InstallSystemService installs the system service
func (*Manager) IsAutoStartNeeded ¶
IsAutoStartNeeded checks if auto-start should be triggered
func (*Manager) RemoveSystemService ¶
RemoveSystemService removes the system service
func (*Manager) RestartDaemon ¶
RestartDaemon restarts the daemon
func (*Manager) SetupBackgroundSync ¶
SetupBackgroundSync sets up background sync during initialization This is called during 'ccr init' when sync is enabled
func (*Manager) StartDaemon ¶
StartDaemon starts the daemon using the configured method
func (*Manager) TriggerAutoStart ¶
TriggerAutoStart starts the daemon if auto-start conditions are met
type PIDManager ¶
type PIDManager struct {
// contains filtered or unexported fields
}
PIDManager handles PID file operations for daemon lifecycle management
func NewPIDManager ¶
func NewPIDManager(pidFile string) *PIDManager
NewPIDManager creates a new PID manager instance
func (*PIDManager) CleanupStalePIDFile ¶
func (pm *PIDManager) CleanupStalePIDFile() error
CleanupStalePIDFile removes PID file if the process is not running
func (*PIDManager) GetPIDFile ¶
func (pm *PIDManager) GetPIDFile() string
GetPIDFile returns the path to the PID file
func (*PIDManager) GetStatus ¶
func (pm *PIDManager) GetStatus() (*PIDStatus, error)
GetStatus returns status information about the daemon
func (*PIDManager) IsProcessRunning ¶
func (pm *PIDManager) IsProcessRunning(pid int) bool
IsProcessRunning checks if a process with the given PID is running
func (*PIDManager) IsRunning ¶
func (pm *PIDManager) IsRunning() bool
IsRunning checks if the daemon process is currently running
func (*PIDManager) KillDaemon ¶
func (pm *PIDManager) KillDaemon() error
KillDaemon gracefully kills the daemon process
func (*PIDManager) ReadPID ¶
func (pm *PIDManager) ReadPID() (int, error)
ReadPID reads the PID from the PID file
func (*PIDManager) RemovePID ¶
func (pm *PIDManager) RemovePID() error
RemovePID removes the PID file
func (*PIDManager) ValidatePIDFile ¶
func (pm *PIDManager) ValidatePIDFile() error
ValidatePIDFile checks if the PID file is valid and cleans up if necessary
func (*PIDManager) WritePID ¶
func (pm *PIDManager) WritePID() error
WritePID writes the current process PID to the PID file
type PIDStatus ¶
type PIDStatus struct {
PIDFile string `json:"pid_file"`
PID int `json:"pid"`
Running bool `json:"running"`
StartTime time.Time `json:"start_time,omitempty"`
Uptime time.Duration `json:"uptime,omitempty"`
Error string `json:"error,omitempty"`
}
PIDStatus contains status information about the daemon process
type ServiceManager ¶
type ServiceManager struct {
// contains filtered or unexported fields
}
ServiceManager handles system service integration for daemon auto-start
func NewServiceManager ¶
func NewServiceManager(cfg *config.Config) *ServiceManager
NewServiceManager creates a new service manager instance
func (*ServiceManager) CreateSystemService ¶
func (sm *ServiceManager) CreateSystemService() error
CreateSystemService creates an OS-appropriate system service
func (*ServiceManager) GetServiceStatus ¶
func (sm *ServiceManager) GetServiceStatus() (*ServiceStatus, error)
GetServiceStatus returns the status of the system service
func (*ServiceManager) IsSystemServiceInstalled ¶
func (sm *ServiceManager) IsSystemServiceInstalled() bool
IsSystemServiceInstalled checks if the system service is installed
func (*ServiceManager) RemoveSystemService ¶
func (sm *ServiceManager) RemoveSystemService() error
RemoveSystemService removes the system service
func (*ServiceManager) RestartSystemService ¶
func (sm *ServiceManager) RestartSystemService() error
RestartSystemService restarts the system service
func (*ServiceManager) StartSystemService ¶
func (sm *ServiceManager) StartSystemService() error
StartSystemService starts the system service
func (*ServiceManager) StopSystemService ¶
func (sm *ServiceManager) StopSystemService() error
StopSystemService stops the system service