daemon

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ProtocolVersion = 1

ProtocolVersion is the current IPC protocol version

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

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

Daemon manages the touchlog daemon lifecycle

func NewDaemon

func NewDaemon(vaultRoot string) *Daemon

NewDaemon creates a new daemon instance for a vault

func (*Daemon) GetPID

func (d *Daemon) GetPID() int

GetPID returns the daemon PID from the PID file

func (*Daemon) IsRunning

func (d *Daemon) IsRunning() bool

IsRunning checks if the daemon is running

func (*Daemon) Start

func (d *Daemon) Start() error

Start starts the daemon

func (*Daemon) Status

func (d *Daemon) Status() (bool, int, error)

Status returns the daemon status

func (*Daemon) Stop

func (d *Daemon) Stop() error

Stop stops the daemon

func (*Daemon) WritePID

func (d *Daemon) WritePID(pid int) error

WritePID writes the PID to the PID file

type Message

type Message struct {
	Version int             `json:"version"`
	Type    MessageType     `json:"type"`
	Payload json.RawMessage `json:"payload,omitempty"`
}

Message represents an IPC message

func NewMessage

func NewMessage(msgType MessageType, payload interface{}) (*Message, error)

NewMessage creates a new message

type MessageType

type MessageType string

MessageType represents the type of IPC message

const (
	MessageTypeStatus       MessageType = "Status"
	MessageTypeQueryExecute MessageType = "QueryExecute"
	MessageTypeReindexPaths MessageType = "ReindexPaths"
	MessageTypeShutdown     MessageType = "Shutdown"
)

type QueryExecuteRequest

type QueryExecuteRequest struct {
	Query string `json:"query"`
}

QueryExecuteRequest represents a query execution request

type QueryExecuteResponse

type QueryExecuteResponse struct {
	Results interface{} `json:"results"`
}

QueryExecuteResponse represents a query execution response

type ReindexPathsRequest

type ReindexPathsRequest struct {
	Paths []string `json:"paths"`
}

ReindexPathsRequest represents a reindex paths request

type ReindexPathsResponse

type ReindexPathsResponse struct {
	Processed int `json:"processed"`
}

ReindexPathsResponse represents a reindex paths response

type Response

type Response struct {
	Version int         `json:"version"`
	Success bool        `json:"success"`
	Error   string      `json:"error,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

Response represents an IPC response

func NewResponse

func NewResponse(success bool, data interface{}, err error) *Response

NewResponse creates a new response

type Server

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

Server handles IPC communication via Unix domain socket

func NewServer

func NewServer(vaultRoot string, cfg *config.Config) (*Server, error)

NewServer creates a new IPC server

func (*Server) Start

func (s *Server) Start() error

Start starts the IPC server

func (*Server) Stop

func (s *Server) Stop() error

Stop stops the IPC server

type StatusRequest

type StatusRequest struct{}

StatusRequest represents a status request

type StatusResponse

type StatusResponse struct {
	Running bool `json:"running"`
	PID     int  `json:"pid,omitempty"`
}

StatusResponse represents a status response

Jump to

Keyboard shortcuts

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