datamodel

package
v0.6.9-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const CheckpointTimeFmt = "20060102150405"

YYYYMMDDHHMMSS in Golang

Variables

This section is empty.

Functions

func DatamodelType added in v0.6.8

func DatamodelType(DM *Datamodel) string

func DiffValue added in v0.6.8

func DiffValue(orig, next cue.Value) (cue.Value, error)

func HistoryBaseDir added in v0.6.8

func HistoryBaseDir() (string, error)

Types

type Datamodel added in v0.6.1

type Datamodel struct {
	*hof.Node[Value]
}

this is basically the same as a Value except that it reporesents a conceptual root and we want specific functions on it that are different from general Nodes' handling and recursion type Datamodel *hof.Node[Value]

func (*Datamodel) CalcDiffs added in v0.6.8

func (dm *Datamodel) CalcDiffs() error

func (*Datamodel) EnrichValue added in v0.6.8

func (dm *Datamodel) EnrichValue() error

func (*Datamodel) FindMaxLabelLen added in v0.6.8

func (dm *Datamodel) FindMaxLabelLen(dflags flags.DatamodelPflagpole) int

func (*Datamodel) GetSnapshotList added in v0.6.8

func (dm *Datamodel) GetSnapshotList() map[string][]*Snapshot

GetSnapshotList finds all snapshots from top-level @history() values. It returns a map where the key is the path to the @history and the value is a list of all snapshots at that value. The top most parent will contain all snapshots for any nested values, due to the way diffs propagate up the hof node tree You should not modify the returned snapshots

func (*Datamodel) HasDiff added in v0.6.8

func (dm *Datamodel) HasDiff() bool

func (*Datamodel) HasHistory added in v0.6.8

func (dm *Datamodel) HasHistory() (bool, error)

check for any history

func (*Datamodel) LoadHistory added in v0.6.8

func (dm *Datamodel) LoadHistory() error

LoadHistory loads the full datamodel history

func (*Datamodel) MakeSnapshot added in v0.6.8

func (dm *Datamodel) MakeSnapshot(timestamp string, dflags flags.DatamodelPflagpole, cflags flags.Datamodel__CheckpointFlagpole) error

MakeSnapshot creates a new snapshot for each history annotation in the Datamodel tree

func (*Datamodel) PrintDiff added in v0.6.8

func (dm *Datamodel) PrintDiff(out io.Writer, dflags flags.DatamodelPflagpole) error

func (*Datamodel) PrintLog added in v0.6.8

func (dm *Datamodel) PrintLog(out io.Writer, max int, ts string, dflags flags.DatamodelPflagpole, cflags flags.Datamodel__LogFlagpole) error

func (*Datamodel) PrintLogByValue added in v0.6.8

func (dm *Datamodel) PrintLogByValue(out io.Writer, max int, dflags flags.DatamodelPflagpole, cflags flags.Datamodel__LogFlagpole) error

func (*Datamodel) PrintTree added in v0.6.8

func (dm *Datamodel) PrintTree(out io.Writer, max int, dflags flags.DatamodelPflagpole) error

func (*Datamodel) Status added in v0.6.8

func (dm *Datamodel) Status() string

type Lense added in v0.6.8

type Lense struct {
	// Explination for the snapshot or changes therein
	Description string

	CurrVersion string
	PrevVersion string

	// calculated by hof
	CurrDiff cue.Value // prev -> this
	PrevDiff cue.Value // this -> prev

	// user defined transform to cover the gaps
	// make use of structural to support @st(...)
	CurrUser cue.Value // prev -> this
	PrevUser cue.Value // this -> prev

	// the full transformation or migration to implement the lens
	// calculated as NextDiff & NextUser => NextMig
	CurrMig cue.Value // prev -> this
	PrevMig cue.Value // this -> prev

}

type Snapshot added in v0.6.8

type Snapshot struct {
	// The current value at this snapshot
	Value cue.Value
	Data  any

	// Position in history
	Pos int

	// Point it was snapshotted
	Timestamp string

	// crypto hash of (snapshot data?)
	Hash string

	// Explination for the snapshot or changes therein
	Message string

	// Lenses between neighboring snapshots
	Lense Lense
}

Snapshot represents a Value at a point in time

type Value added in v0.6.8

type Value struct {
	*hof.Node[Value]

	// curr & lineage
	Snapshot *Snapshot
	// contains filtered or unexported fields
}

func (*Value) Diff added in v0.6.8

func (V *Value) Diff() cue.Value

func (*Value) HasHistory added in v0.6.8

func (V *Value) HasHistory() (bool, error)

check for any history

func (*Value) History added in v0.6.8

func (V *Value) History() []*Snapshot

History returns the full history for a Value

func (*Value) HistoryDir added in v0.6.8

func (V *Value) HistoryDir() (string, error)

func (*Value) LatestSnapshot added in v0.6.8

func (V *Value) LatestSnapshot() *Snapshot

func (*Value) Status added in v0.6.8

func (V *Value) Status() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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