historian

package
v0.0.0-...-05fba6c Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTTL = 30 * 24 * time.Hour

Variables

View Source
var ErrStop = errors.New("stop")

Indiate when Each should stop executing and return cleanly.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Start   *time.Time
	Stop    *time.Time
	Reverse bool
}

type Historian

type Historian struct {
	Path string
	TTL  time.Duration
	// contains filtered or unexported fields
}

func Open

func Open(path string, readOnly bool) (*Historian, error)

func (*Historian) Close

func (h *Historian) Close() error

func (*Historian) Each

func (h *Historian) Each(filter *Filter, cb func(item *Item) error) error

func (*Historian) EachItem

func (h *Historian) EachItem(filter *Filter, exampleItem interface{}, cb func(item interface{}) error) error

func (*Historian) Get

func (h *Historian) Get(id uint64) (*Item, error)

func (*Historian) Len

func (h *Historian) Len() uint

func (*Historian) Put

func (h *Historian) Put(item *Item) error

type Item

type Item struct {
	ID          uint64        `json:"id"`
	RecordedAt  time.Time     `json:"recorded_at"`
	WorkingDir  string        `json:"working_dir"`
	CommandLine string        `json:"command_line,omitempty"`
	ParentPID   *int          `json:"parent_pid,omitempty"`
	ExitStatus  *int          `json:"exit_status,omitempty"`
	Duration    time.Duration `json:"duration,omitempty"`
}

TODO: add current working directory for each item (and pass along to slurp)

func (*Item) String

func (item *Item) String() string

func (*Item) StringWithOpts

func (item *Item) StringWithOpts(showWorkingDir bool) string

Jump to

Keyboard shortcuts

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