Help us shape the future of Go! Take the 2026 Go Developer Survey

daemon

package
v0.48.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupStaleSockets

func CleanupStaleSockets(daemons []DaemonInfo) (int, error)

CleanupStaleSockets removes socket files and PID files for dead daemons

func StopDaemon

func StopDaemon(daemon DaemonInfo) error

StopDaemon gracefully stops a daemon by sending shutdown command via RPC Falls back to SIGTERM if RPC fails

Types

type DaemonInfo

type DaemonInfo struct {
	WorkspacePath       string
	DatabasePath        string
	SocketPath          string
	PID                 int
	Version             string
	UptimeSeconds       float64
	LastActivityTime    string
	ExclusiveLockActive bool
	ExclusiveLockHolder string
	Alive               bool
	Error               string
}

DaemonInfo represents metadata about a discovered daemon

func DiscoverDaemons

func DiscoverDaemons(searchRoots []string) ([]DaemonInfo, error)

DiscoverDaemons discovers running bd daemons using the registry Falls back to filesystem scanning if searchRoots is explicitly provided (for compatibility)

func FindDaemonByWorkspace

func FindDaemonByWorkspace(workspacePath string) (*DaemonInfo, error)

FindDaemonByWorkspace finds a daemon serving a specific workspace

type KillAllFailure

type KillAllFailure struct {
	Workspace string `json:"workspace"`
	PID       int    `json:"pid"`
	Error     string `json:"error"`
}

KillAllFailure represents a failure to kill a specific daemon

type KillAllResults

type KillAllResults struct {
	Stopped  int              `json:"stopped"`
	Failed   int              `json:"failed"`
	Failures []KillAllFailure `json:"failures,omitempty"`
}

KillAllResults contains results from KillAllDaemons

func KillAllDaemons

func KillAllDaemons(daemons []DaemonInfo, force bool) KillAllResults

KillAllDaemons stops all provided daemons, using force if RPC/SIGTERM fail

type Registry

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

Registry manages the global daemon registry file

func NewRegistry

func NewRegistry() (*Registry, error)

NewRegistry creates a new registry instance The registry is stored in ~/.beads/registry.json

func (*Registry) Clear

func (r *Registry) Clear() error

Clear removes all entries from the registry (for testing)

func (*Registry) List

func (r *Registry) List() ([]DaemonInfo, error)

List returns all daemons from the registry, automatically cleaning up stale entries

func (*Registry) Register

func (r *Registry) Register(entry RegistryEntry) error

Register adds a daemon to the registry

func (*Registry) Unregister

func (r *Registry) Unregister(workspacePath string, pid int) error

Unregister removes a daemon from the registry

type RegistryEntry

type RegistryEntry struct {
	WorkspacePath string    `json:"workspace_path"`
	SocketPath    string    `json:"socket_path"`
	DatabasePath  string    `json:"database_path"`
	PID           int       `json:"pid"`
	Version       string    `json:"version"`
	StartedAt     time.Time `json:"started_at"`
}

RegistryEntry represents a daemon entry in the registry

Jump to

Keyboard shortcuts

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