Documentation
¶
Overview ¶
Package histlog is the history log: one JSON line appended for each change sitrep makes to its state, and none for a read. It is a record beside the files, which stay the source of truth, and nothing replays it. See docs/HISTORY-LOG.md.
Index ¶
Constants ¶
const ( QueueAdd = "queue.add" QueueRm = "queue.rm" QueueEdit = "queue.edit" QueueMove = "queue.move" QueueReorder = "queue.reorder" Pin = "pin" Unpin = "unpin" Snooze = "snooze" Unsnooze = "unsnooze" Alias = "alias" Prune = "prune" SessionStart = "session.start" SessionEnd = "session.end" )
The operations a log records.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry struct {
Op string
ID state.ID // the session, or the inbox
Text textsafe.Text // the item, the Objective or the name
Old textsafe.Text // queue.edit: the text before; alias: the name before
From int // queue.reorder: the position the item left
To int // queue.reorder: the position it took
Dest state.ID // queue.move: the queue it went to, with ID as the queue it left
}
Entry is one change. It describes the outcome, not the command: items are named by their text, and a position is a fact about the moment.
type Item ¶
type Item struct {
E string
Time time.Time
Host string
ID state.ID
Op string
Text textsafe.Text
Old textsafe.Text
From int
To int
Dest state.ID
}
Item is an entry as a reader sees it. Every text in it has been made safe again, because the file is untrusted.
type Log ¶
type Log struct {
Dir string // the state folder
Host string // the name of this host, as Host makes it
On bool
MaxMB int // the size limit for both files together
Days int // the age limit
Now func() time.Time
}
Log writes entries to one host's files. The zero Log is off and writes nothing.
type Query ¶
type Query struct {
Host string // only this host; empty means every host in the folder
ID state.ID // only this queue or session (as a source or a destination); empty means all
Op string // only this operation
Since time.Time
Days int // entries older than this many days are ignored, whatever Since says
Now time.Time
Limit int // the most recent this many, or all when below 1
}
Query chooses what Read returns.