state

package
v0.0.0-...-b94449b Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package state manages polyester states.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Name   string                 `json:"name"`
	File   *opfs.StateFileEntry   `json:"file,omitempty"`
	KV     map[string]interface{} `json:"kv,omitempty"`
	Target bool                   `json:"target,omitempty"`
}

func (Entry) Changed

func (e Entry) Changed(oe Entry) bool

func (Entry) ChecksumOnly

func (e Entry) ChecksumOnly() Entry

func (Entry) WithoutTimestamps

func (e Entry) WithoutTimestamps() Entry

type State

type State struct {
	Entries []Entry `json:"entries"`
}

func FromBytes

func FromBytes(b []byte) (State, error)

func FromPath

func FromPath(p string) (State, error)

func FromReader

func FromReader(r io.Reader) (State, error)

func New

func New() State

func (State) Append

func (s State) Append(next ...Entry) State

func (State) AppendKV

func (s State) AppendKV(name string, val interface{}) (State, error)

func (State) Changed

func (s State) Changed(other State) bool

func (State) Diff

func (s State) Diff(w io.Writer, other State) error

func (State) Empty

func (s State) Empty() bool

func (State) Map

func (s State) Map(fn func(e Entry) Entry) State

func (State) Source

func (s State) Source() State

func (State) Target

func (s State) Target() State

func (State) WriteFile

func (s State) WriteFile(p string) error

func (State) WriteTo

func (s State) WriteTo(w io.Writer) (int64, error)

type States

type States struct {
	States []StatesEntry `json:"states"`
}

func (States) Append

func (ss States) Append(op string, s State) States

func (States) Empty

func (ss States) Empty() bool

func (States) Find

func (ss States) Find(op string) []State

type StatesEntry

type StatesEntry struct {
	Op    string `json:"op,omitempty"`
	State State  `json:"state"`
}

Jump to

Keyboard shortcuts

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