state

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustPrintLauncherStateSimpleGlobal

func MustPrintLauncherStateSimpleGlobal(w **tabwriter.Writer, runDir string)

MustPrintLauncherStateSimpleGlobal prints active launcher states of all simple stores in an implementation-specific way.

Types

type Backend

type Backend interface {
	Save(state *State) error
	Destroy(pid int) error
	Load() ([]*State, error)
	Len() (int, error)
}

Backend provides access to the store

type State

type State struct {
	// fortify instance id
	ID fst.ID `json:"instance"`
	// child process PID value
	PID int `json:"pid"`
	// sealed app configuration
	Config *fst.Config `json:"config"`

	// process start time
	Time time.Time
}

State is the on-disk format for a fortified process's state information

type Store

type Store interface {
	// Do calls f exactly once and ensures store exclusivity until f returns.
	// Returns whether f is called and any errors during the locking process.
	// Backend provided to f becomes invalid as soon as f returns.
	Do(f func(b Backend)) (bool, error)

	// Close releases any resources held by Store.
	Close() error
}

func NewSimple

func NewSimple(runDir string, prefix ...string) Store

NewSimple returns an instance of a file-based store.

Jump to

Keyboard shortcuts

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