daemoncmd

package
v3.0.0-beta10 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WaitRunningTimeout = 20 * time.Second
	WaitRunningDelay   = 500 * time.Millisecond
	WaitStoppedTimeout = 4 * time.Second
	WaitStoppedDelay   = 250 * time.Millisecond

	ErrAlreadyRunning = errors.New("daemon already running")
)

Functions

This section is empty.

Types

type Manager

type Manager interface {
	Activated(ctx context.Context) (bool, error)
	CalledFromManager() bool
	Close() error
	Defined(ctx context.Context) (bool, error)
	Start(ctx context.Context) error
	Restart() error
	Stop(context.Context) error
	IsSystemStopping() (bool, error)
}

type NodeMeta

type NodeMeta struct {
	Node string `json:"node"`
}

func (NodeMeta) Unstructured

func (t NodeMeta) Unstructured() map[string]any

type Ping

type Ping struct {
	Ping   bool   `json:"ping"`
	Detail string `json:"detail"`
}

func (Ping) Unstructured

func (t Ping) Unstructured() map[string]any

type PingItem

type PingItem struct {
	Data Ping     `json:"data"`
	Meta NodeMeta `json:"meta"`
}

func (PingItem) Unstructured

func (t PingItem) Unstructured() map[string]any

type PingItems

type PingItems []PingItem

type T

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

func New

func New(c *client.T) *T

func (*T) IsRunning

func (t *T) IsRunning() (bool, error)

IsRunning function detect daemon status using api

it returns true is daemon is running, else false

func (*T) LoadManager

func (t *T) LoadManager(ctx context.Context) error

func (*T) Restart

func (t *T) Restart(ctx context.Context, profile string) error

Restart handle daemon restart from command origin.

It is used to forward restart control to (systemd) manager (when the origin is not systemd)

func (*T) Run

func (t *T) Run(ctx context.Context, profile string) error

func (*T) SetNode

func (t *T) SetNode(node string)

func (*T) Start

func (t *T) Start(ctx context.Context, profile string) error

Start handle daemon start from command origin.

It is used to forward start control to (systemd) manager (when the origin is not systemd)

func (*T) Stop

func (t *T) Stop(ctx context.Context) error

Stop handle daemon stop from command origin.

It is used to forward stop control to (systemd) manager (when the origin is not systemd)

func (*T) StopWithoutManager

func (t *T) StopWithoutManager() error

StopWithoutManager function will stop daemon with internal lock protection

func (*T) WaitRunning

func (t *T) WaitRunning() error

WaitRunning function waits for daemon running

It needs to be called from a cli lock protection

Jump to

Keyboard shortcuts

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