state

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaximumHistorySize = 10

Variables

This section is empty.

Functions

func Init

func Init(config *config.Config) error

Init checks if the state directory exists and creates all directories and files if necessary

func Write

func Write(config *config.Config, state *State) error

Write serializes the current state with koanf

Types

type Backup added in v1.2.0

type Backup struct {
	Revisions []Revision `json:"revisions,omitempty"`
}

type Context added in v1.1.0

type Context struct {
	Active  string    `json:"active,omitempty"`
	History []History `json:"history,omitempty"`
}

type Group added in v1.1.0

type Group struct {
	Active  string    `json:"active,omitempty"`
	History []History `json:"history,omitempty"`
}

type History added in v1.2.0

type History string

func ComputeHistory added in v1.1.0

func ComputeHistory(config *config.Config, entry History, history []History) []History

ComputeHistory takes the current history and appends a new entry If the history size is larger than the configured or default size, it will remove the oldest entry from the history

type Revision added in v1.2.0

type Revision string

type State

type State struct {
	Group   Group   `json:"group"`
	Context Context `json:"context"`
	Backup  Backup  `json:"backup"`
}

func Read added in v1.1.0

func Read(config *config.Config) (*State, error)

Read reads the current state file and serialize it with koanf

Jump to

Keyboard shortcuts

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