pause

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 17 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 pause is the emergency stop of icebath: a stop a person puts in force over everything or over one profile, under which nothing starts work on its own. It is kept on disk, so it outlives a restart and holds in every icebath of the settings folder within seconds, with who put it in force, when and why. The host names no feature: each feature that starts work registers what it holds and how it takes it up again, stops what it has going as a stop comes into force, and asks the host before it starts work

Index

Constants

View Source
const Everything = "all"

Word that names every profile as the scope of a stop

Variables

This section is empty.

Functions

func Engaged

func Engaged(stop Stop, already, interrupted bool) string

What a person who put the stop in force is told: what is paused and why, and what of the work going on was stopped; or, for a stop that was in force already, since when

func Lifted

func Lifted(lifted []Stop, still Stop, held bool) string

What a person who lifted stops is told: what runs again, and the stop that still holds when one does

Types

type Halter

type Halter interface {
	// Stops what the feature has going of the profile the stop holds, every profile's for a stop of everything, the stop said as why; how
	// many things it stopped. Returns at once, what it stopped ending on its own
	Halt(ctx context.Context, stop Stop) int
}

Registrant whose work goes on when a stop comes into force, which it stops, as the replies of the agent and the runs of the runner

type Hold

type Hold struct {
	// What is held, such as "Scheduled jobs" or "Messages of chat apps"
	Title string
	// What becomes of it while it is held and once the stop is lifted, a sentence: "Jobs due meanwhile run late or are skipped as each job's
	// catch-up says."
	Resume string
	// How many of it wait now, -1 when they are not counted
	Waiting int
}

One kind of work a feature holds while a stop is in force, as a person reads it

type Pause

type Pause struct {
	Registry
	// contains filtered or unexported fields
}

The emergency stop of every icebath of the settings folder

func New

func New(cfg *config.Config) *Pause

func (*Pause) Engage

func (p *Pause) Engage(ctx context.Context, profile, by, reason string) (Stop, bool, int, error)

Puts a stop in force over the profile, over everything for none, by who and for why as a person reads them: what holds from now on, whether a stop of the scope was in force already, whose time it keeps while it takes the new words, and how many things going on it stopped, as the settings of the profile it holds say whether it stops them. Every icebath of the settings folder holds it within seconds, and this one at once

func (*Pause) Held

func (p *Pause) Held(profile string) string

What holds the work of the profile, the notice of its stop; empty while nothing holds it

func (*Pause) Lift

func (p *Pause) Lift(ctx context.Context, scopes ...string) ([]Stop, error)

Lifts the stops of the scopes, each a profile or empty for the stop of everything: those that were in force, which every icebath of the settings folder lets go of within seconds and this one at once

func (*Pause) Paused

func (p *Pause) Paused(profile string) (Stop, bool)

The stop that holds the work of the profile, the one of everything first; false when none does. The profile of this process for none

func (*Pause) Register

func (p *Pause) Register(registrant Registrant)

Adds a registrant; a registry nested in the host reaches the host through Host

func (*Pause) Scope

func (p *Pause) Scope(word string) (string, error)

The profile a scope word names, empty for everything: all, or a profile by its name with or without an at sign before it; an error a person reads for a profile there is not

func (*Pause) Stops

func (p *Pause) Stops() []Stop

Every stop in force: the one of everything, then those of profiles by name

func (*Pause) Telling

func (p *Pause) Telling(tell func(stop Stop, on bool))

Hands over what is told of each stop as it comes into force and as it is lifted in this process, such as the monitoring of icebath

func (*Pause) Watch

func (p *Pause) Watch(ctx context.Context) error

Looks every two seconds at the stops kept on disk until the context ends, acting on those put in force or lifted in another icebath

type Registrant

type Registrant interface {
	// What the feature holds of the profile of the settings while a stop is in force, each kind of work it starts on its own; read quickly
	Holds(cfg *config.Config) []Hold
}

A feature that starts work on its own, such as a scheduler, a listener or the agent's replies: what of it a stop holds

type Registry

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

func (*Registry) Holds

func (r *Registry) Holds(cfg *config.Config) []Hold

What every registrant holds of the profile of the settings, in the order they were registered

func (*Registry) Host

func (r *Registry) Host() *Pause

Host the registry is nested in, through which a plugin asks whether its work is held

func (*Registry) Register

func (r *Registry) Register(registrant Registrant)

type Resumer

type Resumer interface {
	// Takes up what the feature held of the profile the lifted stop held, every profile's for one of everything that no other stop holds
	// still; the feature asks the host of any profile it is not sure of
	Resume(ctx context.Context, lifted Stop)
}

Registrant that takes up what it held once a stop is lifted, such as the events a listener kept meanwhile

type Stop

type Stop struct {
	// Profile it holds, empty for a stop of every profile
	Profile string `json:"profile,omitempty"`
	// Who put it in force, as a person reads it, such as "you in the app" or "Alice on Telegram"; empty when not known
	By string    `json:"by,omitempty"`
	At time.Time `json:"at"`
	// Why, as the person who put it in force gave it; empty for none
	Reason string `json:"reason,omitempty"`
}

A stop in force

func (Stop) Notice

func (s Stop) Notice() string

What a person who wrote to icebath while the stop holds is told, a sentence or two

func (Stop) Scope

func (s Stop) Scope() string

What the stop holds, as a person reads it: icebath, or the profile of the name

func (Stop) Since

func (s Stop) Since() string

Who put the stop in force and since when, with why, a phrase that follows "paused": "by Alice on Telegram since 14:02, for a deploy"

Directories

Path Synopsis
/pause and /unpause: the emergency stop of icebath, put in force over everything or over one profile and lifted.
/pause and /unpause: the emergency stop of icebath, put in force over everything or over one profile and lifted.

Jump to

Keyboard shortcuts

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