daemon

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupStalePID

func CleanupStalePID(pidPath string)

CleanupStalePID removes the PID file if the referenced process is not running.

func GracefulStop

func GracefulStop(pid int) error

GracefulStop sends an interrupt signal to the process with the given PID.

func IsRunning

func IsRunning(pidPath string) bool

IsRunning checks if a daemon is running by reading the PID file and verifying the process exists.

func ReadPID

func ReadPID(path string) (int, error)

ReadPID reads a PID from the given file.

func RemovePID

func RemovePID(path string)

RemovePID removes the PID file.

func StartDaemonProcess

func StartDaemonProcess() error

StartDaemonProcess starts the daemon as a background process by re-executing the current binary with "daemon start" arguments.

func WritePID

func WritePID(path string) error

WritePID writes the current process PID to the given path.

Types

type Server

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

Server is the daemon's Unix socket server that receives and writes events.

func NewServer

func NewServer(socketPath string, paths config.Paths, cfg config.Config) *Server

NewServer creates a new daemon server.

func (*Server) EventCount

func (s *Server) EventCount() int64

EventCount returns the total number of events received.

func (*Server) EventsSinceCompile

func (s *Server) EventsSinceCompile() int64

EventsSinceCompile returns the number of events since the counter was last reset.

func (*Server) LastEventTime

func (s *Server) LastEventTime() time.Time

LastEventTime returns the time of the last received event.

func (*Server) ResetCompileCounter added in v0.1.7

func (s *Server) ResetCompileCounter()

ResetCompileCounter resets the events-since-compile counter to zero.

func (*Server) SetIdleTimeout

func (s *Server) SetIdleTimeout(d time.Duration)

SetIdleTimeout overrides the idle timeout duration. For testing.

func (*Server) Start

func (s *Server) Start() error

Start begins listening on the Unix socket. Blocks until Stop is called.

func (*Server) Stop

func (s *Server) Stop()

Stop shuts down the server gracefully.

type Watcher

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

Watcher monitors directories for new skill files and invokes a callback.

func NewWatcher

func NewWatcher(dirs []string, onNewSkill func(path string)) (*Watcher, error)

NewWatcher creates a file watcher for the given directories.

func (*Watcher) Start

func (w *Watcher) Start()

Start begins watching for file system events. Blocks until Stop is called.

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop closes the watcher.

Jump to

Keyboard shortcuts

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