state

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const NameSeparator = "."

Variables

This section is empty.

Functions

func CleanupStale

func CleanupStale(dirPath string, cleaner Cleaner, log *slog.Logger) error

func FromInstanceDir

func FromInstanceDir(dirPath string) (int, uuid.UUID, error)

func InstanceDir

func InstanceDir(dirPath string, pid int, id uuid.UUID) string

func Lock

func Lock(dirPath string) (*os.File, error)

func ProcRunning

func ProcRunning(pid int) (bool, error)

Types

type Cleaner

type Cleaner interface {
	CleanUp(context.Context, string) error
}

type State

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

func Init

func Init(dirPath string, pID int, log *slog.Logger) (*State, error)

func Load

func Load(dirPath string, log *slog.Logger) (*State, error)

func (*State) AddID

func (s *State) AddID(id string) error

func (*State) CleanIDs

func (s *State) CleanIDs(ctx context.Context, cleaner Cleaner)

func (*State) Dir

func (s *State) Dir() string

func (*State) Finalize

func (s *State) Finalize(cleaner Cleaner) error

func (*State) IDs

func (s *State) IDs() []string

func (*State) Remove

func (s *State) Remove() error

func (*State) RemoveID

func (s *State) RemoveID(id string) error

func (*State) Time

func (s *State) Time() time.Time

Jump to

Keyboard shortcuts

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