Documentation
¶
Index ¶
- type DaemonImpl
- func (d *DaemonImpl[T]) DetachOn(detachSig <-chan struct{}) T
- func (d *DaemonImpl[T]) FromCobra(command *cobra.Command) v1.Daemon[*cobra.Command]
- func (d *DaemonImpl[T]) IsAlive() bool
- func (d *DaemonImpl[T]) LogFile() (string, error)
- func (d *DaemonImpl[T]) Name() (string, error)
- func (d *DaemonImpl[T]) PID() (int, error)
- func (d *DaemonImpl[T]) PIDFile() (string, error)
- func (d *DaemonImpl[T]) Status(marshal func(any) ([]byte, error)) error
- func (d *DaemonImpl[T]) Stop() error
- func (d *DaemonImpl[T]) WithContext(parent context.Context) v1.Daemon[T]
- func (d *DaemonImpl[T]) WithGroup(name *string) v1.Daemon[T]
- func (d *DaemonImpl[T]) WithName(name string) v1.Daemon[T]
- func (d *DaemonImpl[T]) WithShutdownSignal(sigs ...os.Signal) v1.Daemon[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DaemonImpl ¶
type DaemonImpl[T any] struct { // contains filtered or unexported fields }
DaemonImpl is the default Daemon implementation. T is the wrapped value's type (and what Into returns).
func New ¶
func New[T any]() *DaemonImpl[T]
New returns an unconfigured DaemonImpl. The root `daemonize.NewDaemon` façade wraps this and returns the v1.Daemon[any] interface; callers reaching directly into v1alpha1 use this for the concrete struct.
func (*DaemonImpl[T]) DetachOn ¶
func (d *DaemonImpl[T]) DetachOn(detachSig <-chan struct{}) T
DetachOn records the readiness channel, then assembles the lifecycle wrapper for the wrapped value and returns it (as T), dispatching on inner's type.
func (*DaemonImpl[T]) FromCobra ¶
func (d *DaemonImpl[T]) FromCobra(command *cobra.Command) v1.Daemon[*cobra.Command]
FromCobra wraps command, retyping the builder to *cobra.Command so Into returns the assembled root command. Configure with the With* methods after this call.
func (*DaemonImpl[T]) IsAlive ¶
func (d *DaemonImpl[T]) IsAlive() bool
IsAlive reports whether the process named by the pid file is running.
func (*DaemonImpl[T]) LogFile ¶
func (d *DaemonImpl[T]) LogFile() (string, error)
func (*DaemonImpl[T]) Name ¶
func (d *DaemonImpl[T]) Name() (string, error)
func (*DaemonImpl[T]) PID ¶
func (d *DaemonImpl[T]) PID() (int, error)
func (*DaemonImpl[T]) PIDFile ¶
func (d *DaemonImpl[T]) PIDFile() (string, error)
func (*DaemonImpl[T]) Status ¶
func (d *DaemonImpl[T]) Status(marshal func(any) ([]byte, error)) error
func (*DaemonImpl[T]) Stop ¶
func (d *DaemonImpl[T]) Stop() error
Stop sends a termination signal to the running process and waits for it to exit. The log is tailed throughout so the worker's shutdown output reaches the user.
func (*DaemonImpl[T]) WithContext ¶
func (d *DaemonImpl[T]) WithContext(parent context.Context) v1.Daemon[T]
func (*DaemonImpl[T]) WithGroup ¶
func (d *DaemonImpl[T]) WithGroup(name *string) v1.Daemon[T]
func (*DaemonImpl[T]) WithName ¶
func (d *DaemonImpl[T]) WithName(name string) v1.Daemon[T]
func (*DaemonImpl[T]) WithShutdownSignal ¶
func (d *DaemonImpl[T]) WithShutdownSignal(sigs ...os.Signal) v1.Daemon[T]