daemon

package
v0.0.0-...-91dc524 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package daemon implements a service for mediating access to the data store, and its client.

Most RPCs exposed by the service correspond to the methods of Store in the store package and are not documented here.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDaemonUnreachable is returned when the daemon cannot be reached after
	// several retries.
	ErrDaemonUnreachable = errors.New("daemon offline")
)

Functions

func Activate

func Activate(stderr io.Writer, spawnCfg *daemondefs.SpawnConfig) (daemondefs.Client, error)

Activate returns a daemon client, either by connecting to an existing daemon, or spawning a new one. It always returns a non-nil client, even if there was an error.

func NewClient

func NewClient(sockPath string) daemondefs.Client

NewClient creates a new Client instance that talks to the socket. Connection creation is deferred to the first request.

func Serve

func Serve(sockpath, dbpath string, opts ServeOpts) int

Serve runs the daemon service, listening on the socket specified by sockpath and serving data from dbpath until all clients have exited. See doc for ServeChans for additional options.

Types

type Program

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

Program is the daemon subprogram.

func (*Program) RegisterFlags

func (p *Program) RegisterFlags(fs *prog.FlagSet)

func (*Program) Run

func (p *Program) Run(fds [3]*os.File, args []string) error

type ServeOpts

type ServeOpts struct {
	// If not nil, will be closed when the daemon is ready to serve requests.
	Ready chan<- struct{}
	// Causes the daemon to abort if closed or sent any date. If nil, Serve will
	// set up its own signal channel by listening to SIGINT and SIGTERM.
	Signals <-chan os.Signal
	// If not nil, overrides the response of the Version RPC.
	Version *int
}

ServeOpts keeps options that can be passed to Serve.

Directories

Path Synopsis
Package daemondefs contains definitions used for the daemon.
Package daemondefs contains definitions used for the daemon.
internal
api
Package api defines types and constants useful for the API between the daemon service and client.
Package api defines types and constants useful for the API between the daemon service and client.

Jump to

Keyboard shortcuts

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