daemoncmd

package
v0.0.0-...-63b02d4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 25 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
)

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
}

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 NewContext

func NewContext(ctx context.Context, 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) RestartFromCmd

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

RestartFromCmd handle daemon restart from command origin.

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

func (*T) SetNode

func (t *T) SetNode(node string)

func (*T) Start

func (t *T) Start() error

Start function will start daemon with internal lock protection

func (*T) StartFromCmd

func (t *T) StartFromCmd(ctx context.Context, foreground bool, profile string) error

StartFromCmd 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() error

Stop function will stop daemon with internal lock protection

func (*T) StopFromCmd

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

StopFromCmd handle daemon stop from command origin.

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

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