history

package
v0.0.642 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package history provides an append only, size limited log of recent actions that Keeper has taken for each subpool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type History

type History struct {
	sync.Mutex
	// contains filtered or unexported fields
}

History uses a `*recordLog` per pool to store a record of recent actions that Keeper has taken. Using a log per pool ensure that history is retained for inactive pools even if other pools are very active.

func New

func New(maxRecordsPerKey int, path string) (*History, error)

New creates a new History struct with the specificed recordLog size limit.

func (*History) AllRecords

func (h *History) AllRecords() map[string][]*Record

AllRecords generates a map from pool key -> sorted records for the pool.

func (*History) Flush

func (h *History) Flush()

Flush writes the action history to persistent storage if configured to do so.

func (*History) Merge

func (h *History) Merge(other *History)

Merge combines the logs from the other history

func (*History) Record

func (h *History) Record(poolKey, action, baseSHA, err string, targets []v1alpha1.Pull)

Record appends an entry to the recordlog specified by the poolKey.

func (*History) ServeHTTP

func (h *History) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves a JSON mapping from pool key -> sorted records for the pool.

type Record

type Record struct {
	Time    time.Time       `json:"time"`
	Action  string          `json:"action"`
	BaseSHA string          `json:"baseSHA,omitempty"`
	Target  []v1alpha1.Pull `json:"target,omitempty"`
	Err     string          `json:"err,omitempty"`
}

Record is an entry describing one action that Keeper has taken (e.g. TRIGGER or MERGE).

Jump to

Keyboard shortcuts

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