Documentation
¶
Overview ¶
Package daemon serves sessionapi.API for one hive data directory on a unix socket, so every client on the machine shares one writer and one status tracker.
Index ¶
Constants ¶
const ( LaunchdLabel = "com.colonyops.hive.daemon" SystemdUnitName = "hive-daemon.service" )
Variables ¶
var ErrAlreadyRunning = errors.New("hive daemon already running")
Functions ¶
Types ¶
type Options ¶
type Options struct {
Config *config.Config
// Ports are the daemon's drivers. DB and Bus must be nil: Run opens them.
// Stdout and Stderr should go to the log, since no terminal watches.
Ports hive.Ports
Version string
// WaitLock blocks until the running daemon exits instead of returning
// ErrAlreadyRunning. The OS service units use it, so a unit restart
// queues behind a daemon a client spawned.
WaitLock bool
// Reload loads the config a Reload RPC applies. nil rejects the RPC.
Reload func(ctx context.Context) (*config.Config, error)
// OnReady runs once the socket accepts connections.
OnReady func(socketPath string)
// OwnershipCheckInterval is how often the daemon checks it still owns its
// data dir and socket. Zero means every 30s.
OwnershipCheckInterval time.Duration
}
type Unit ¶
Unit is an OS service definition for the daemon and the file it belongs in.
func LaunchdUnit ¶
LaunchdUnit is a launchd agent that keeps `<binary> daemon run --wait-lock` alive. --wait-lock queues it behind a daemon a client spawned, instead of exiting and being restarted in a loop. AbandonProcessGroup keeps launchd from killing a tmux server the daemon started when the daemon exits.
func SystemdUnit ¶
SystemdUnit is a systemd user unit for `<binary> daemon run --wait-lock`. KillMode=process stops only the daemon on a restart, not a tmux server it started in its cgroup.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package daemonpath names the files of the hive daemon for a data directory, so a client finds them without importing the daemon.
|
Package daemonpath names the files of the hive daemon for a data directory, so a client finds them without importing the daemon. |
|
gen
|
|
|
Package wire converts between the hive.daemon.v1 messages and the Go types sessionapi.API speaks, for both the daemon and its client.
|
Package wire converts between the hive.daemon.v1 messages and the Go types sessionapi.API speaks, for both the daemon and its client. |