daemon

package
v0.3.24 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package daemon contains daemon types and functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig[T any](path string) (*T, error)

LoadConfig loads a Daemon Config which is expected to follow the required structure. This checks if any Interval values are 0 (invalid).

Types

type Info

type Info struct {
	Start    string
	Last     string
	Duration string
}

type Instance

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

func NewInstance

func NewInstance() *Instance

NewInstance creates a new Daemon Instance

func (*Instance) All added in v0.3.11

func (i *Instance) All() map[string]Info

All returns info on all running daemons

func (*Instance) Run added in v0.3.11

func (i *Instance) Run(name string, task func(), interval int, timeScale time.Duration)

Run runs a task every given interval, where TimeScale = time.Hour, time.Minute, time.Second

func (*Instance) RunWithOffset added in v0.3.23

func (i *Instance) RunWithOffset(name string, task func(), interval int, timeScale time.Duration, offset int, offsetScale time.Duration)

RunWithOffset runs a task every given interval, with an initial offset sleep

Jump to

Keyboard shortcuts

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