daemon

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotRunning = errors.New("tb daemon is not running")

Functions

func BuildID

func BuildID() string

func Dir

func Dir() string

func LogPath

func LogPath() string

func Running

func Running() bool

func SocketPath

func SocketPath() string

func StopAfterReply added in v0.5.3

func StopAfterReply(ctx context.Context)

Types

type Client

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

func Connect

func Connect() (*Client, error)

func Dial added in v0.6.4

func Dial() *Client

func (*Client) Call

func (c *Client) Call(req Request, onPart func(Response)) (Response, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) SetDeadline added in v0.6.4

func (c *Client) SetDeadline(t time.Time) error

type Handler

type Handler func(ctx context.Context, req Request, send func(Response)) Response

type Request

type Request struct {
	Cmd  string          `json:"cmd"`
	Args json.RawMessage `json:"args,omitempty"`
	Cwd  string          `json:"cwd,omitempty"`
}

type Response

type Response struct {
	OK     bool            `json:"ok"`
	Exit   int             `json:"exit"`
	Text   string          `json:"text,omitempty"`
	JSON   json.RawMessage `json:"json,omitempty"`
	Image  []byte          `json:"image,omitempty"`
	More   bool            `json:"more,omitempty"`
	Stderr bool            `json:"stderr,omitempty"`
}

func StopDaemon added in v0.5.3

func StopDaemon() (Response, error)

type Server

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

func NewServer

func NewServer(idle time.Duration) *Server

func (*Server) Handle

func (s *Server) Handle(cmd string, h Handler)

func (*Server) OnStop added in v0.5.3

func (s *Server) OnStop(f func(ctx context.Context))

func (*Server) Serve

func (s *Server) Serve() error

func (*Server) Stop

func (s *Server) Stop()

func (*Server) StopOnSignals added in v0.5.3

func (s *Server) StopOnSignals(sigs ...os.Signal) func()

Jump to

Keyboard shortcuts

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