daemon

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 16 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

Overview

Package daemon owns scheduling passes and the process lifetime lock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Holder

func Holder(data string) int

Holder checks the recorded owner identity without ever taking the lock.

func Wake

func Wake(data string) bool

Wake validates the recorded process identity without competing for its lease.

Types

type Engine

type Engine struct {
	DB                    *store.Store
	Clock                 clock.Clock
	Runner                Executor
	Sync                  func(context.Context) (map[string]jobs.Job, error)
	Recover               func(context.Context, *store.Run) error
	Concurrency, KeepRuns int
	DataDir               string
	Log                   io.Writer
	// contains filtered or unexported fields
}

func (*Engine) Claim

func (e *Engine) Claim(ctx context.Context, defs map[string]jobs.Job, states map[string]store.JobState) ([]store.Run, error)

func (*Engine) Enqueue

func (e *Engine) Enqueue(ctx context.Context, defs map[string]jobs.Job, states map[string]store.JobState) error

func (*Engine) LogJob

func (e *Engine) LogJob(name, status string)

func (*Engine) LogRun

func (e *Engine) LogRun(r store.Run)

func (*Engine) Loop

func (e *Engine) Loop(ctx context.Context, hup <-chan struct{}) error

Loop responds to reload and otherwise wakes by the next fire, capped at 30s.

func (*Engine) Reconcile

func (e *Engine) Reconcile(ctx context.Context) error

func (*Engine) Retention

func (e *Engine) Retention(ctx context.Context) error

func (*Engine) Start

func (e *Engine) Start(ctx context.Context, runs []store.Run, defs map[string]jobs.Job)

func (*Engine) Tick

func (e *Engine) Tick(ctx context.Context) error

func (*Engine) Wait

func (e *Engine) Wait()

type Executor

type Executor interface {
	Run(context.Context, jobs.Job, store.Run, bool) (store.Run, error)
}

type Lease

type Lease struct {
	*os.File
	// contains filtered or unexported fields
}

func AdoptLock

func AdoptLock(f *os.File) (*Lease, error)

func Lock

func Lock(data string) (*Lease, error)

func (*Lease) Close

func (l *Lease) Close() error

func (*Lease) Transfer

func (l *Lease) Transfer()

type LockedError

type LockedError struct{ PID string }

func (*LockedError) Error

func (e *LockedError) Error() string

type Processes

type Processes struct {
	GroupExists func(int) bool
	Alive       func(int) bool
	Start       func(int) (time.Time, error)
	Kill        func(int) error
}

Process seams let restart rules use fake identities without starting processes.

Jump to

Keyboard shortcuts

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