Documentation
¶
Index ¶
- Constants
- func IsDaemonChild() bool
- func SocketPathForVault(vaultRoot string) (string, error)
- type Daemon
- type Message
- type MessageType
- type QueryExecuteRequest
- type QueryExecuteResponse
- type ReindexPathsRequest
- type ReindexPathsResponse
- type Response
- type Server
- type StatusRequest
- type StatusResponse
Constants ¶
const ProtocolVersion = 1
ProtocolVersion is the current IPC protocol version
Variables ¶
This section is empty.
Functions ¶
func IsDaemonChild ¶ added in v2.6.0
func IsDaemonChild() bool
IsDaemonChild returns true if the current process is the daemon child process
func SocketPathForVault ¶ added in v2.6.1
SocketPathForVault derives a deterministic Unix domain socket path for the given vault. Unix domain socket paths are limited to 104 bytes on macOS (108 on Linux). To avoid exceeding this limit with long vault paths, we derive a short hash-based path in /tmp that is always well under the limit.
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon manages the touchlog daemon lifecycle
func (*Daemon) Run ¶ added in v2.6.0
Run runs the daemon in the foreground (blocking). This is called by the daemon child process after forking. It blocks until the daemon receives a shutdown signal (SIGINT, SIGTERM) or the IPC server is shut down via a Shutdown command.
func (*Daemon) SocketPath ¶ added in v2.6.1
SocketPath returns the path to the daemon's Unix domain socket
func (*Daemon) Start ¶
Start launches the daemon as a background process. It forks a child process that runs the daemon loop via Run(). The parent process returns after confirming the child started successfully.
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 ¶
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 ¶
NewServer creates a new IPC server. sockPath is the Unix domain socket path for IPC communication. Use SocketPathForVault to derive a safe socket path that respects the macOS 104-byte limit for Unix domain socket paths.
func (*Server) Done ¶ added in v2.6.0
func (s *Server) Done() <-chan struct{}
Done returns a channel that's closed when the server is shut down. This allows callers to block until the server exits (e.g., via IPC Shutdown).
func (*Server) SocketPath ¶ added in v2.6.1
SocketPath returns the path to the server's Unix domain socket
type StatusResponse ¶
StatusResponse represents a status response