Documentation
¶
Overview ¶
Package timeline reads a task's timeline: its own events and those of the units linked to it, every one kept forever.
Index ¶
- Constants
- func HeldOf(ctx context.Context, r Records, e task.Task) ([]unit.Unit, error)
- func Pick(recs map[unit.Unit]port.Event, id task.ID, held []unit.Unit) (port.Event, bool)
- func RecordOf(ctx context.Context, r Records, kind string, id task.ID, held []unit.Unit) (port.Event, bool, error)
- type Event
- type Filter
- type Holdings
- type Log
- type Merged
- type Node
- type Reader
- type Records
- type Rule
- type Word
- type Words
Constants ¶
const KindRecord = "record"
KindRecord is the event kind of a record: its Key is the record kind of records.toml, its Actor the writer, its Data the record's JSON. A unit keeps one record of each kind, the newest.
Variables ¶
This section is empty.
Functions ¶
func HeldOf ¶ added in v0.4.0
HeldOf are the units a record of task e is read from after its own: e's units, then, when r is also Holdings, the other units it lists, the newest merged task's first.
func Pick ¶
Pick is task id's record among recs, the records of its kind by unit, as RecordOf picks it.
func RecordOf ¶
func RecordOf(ctx context.Context, r Records, kind string, id task.ID, held []unit.Unit) (port.Event, bool, error)
RecordOf is task id's record of kind: its own, else the first of held, the units it holds in order, that keeps one, as a pull request task's brief is its pull request's; false when none does.
Types ¶
type Event ¶
Event is an event of a timeline at Seq, its row in the event log, which grows with every event stored and orders and pages the timeline.
type Filter ¶
Filter narrows a timeline: Kinds keeps those event kinds (every kind when empty), Except drops those, Before the events whose Seq is lower (all when 0), Limit at most that many (all when 0).
type Holdings ¶
type Holdings interface {
// UnitsOf are the units task id holds, in its order, then the own unit
// (task.UnitOf) of every task merged into id, transitively; empty for a
// task with none or no such task.
UnitsOf(ctx context.Context, id task.ID) ([]unit.Unit, error)
}
Holdings are the units the tasks hold.
type Log ¶
type Log interface {
// EventsOf are the events of units f keeps, newest first (by Seq).
EventsOf(ctx context.Context, units []unit.Unit, f Filter) ([]Event, error)
}
Log reads the event log.
type Merged ¶
type Merged struct {
Log Log
Holdings Holdings
// Except are the event kinds no timeline shows, asked for by kind or not.
Except []string
}
Merged is the Reader over the event log: a task's timeline is its own events and those of the units it holds, without the merge records and the kinds of Except.
type Node ¶ added in v0.4.0
type Node struct {
Rule, Label, Tone string
At, End time.Time
Running bool
Actor string
Events []Event
}
Node is one fact of a timeline: the events a rule folded, or one event no rule took (Rule ""). End is zero for a single event and for a span still Running.
type Reader ¶
type Reader interface {
// Of are the events of task id and of its linked units that f keeps,
// newest first (by Seq); empty for a task with none.
Of(ctx context.Context, id task.ID, f Filter) ([]Event, error)
}
Reader reads timelines.
type Records ¶
type Records interface {
// Records are the record of kind on each of units that keeps one; with
// no units, on every unit that keeps one.
Records(ctx context.Context, kind string, units ...unit.Unit) (map[unit.Unit]port.Event, error)
}
Records reads the records the units keep.
type Rule ¶ added in v0.4.0
type Rule struct {
Name string
Start, End, Absorb []string
Label, Running string
// Unfinished is how a span reads whose end never came before its start kind came again.
Unfinished string
Tone string
// Subs words an event's sub, such as a review's verdict; a sub it leaves out reads as itself.
Subs map[string]string
}
Rule folds events into one node of a timeline, as a profile's [facts.<name>] declares it: a Start kind opens the node, an End kind closes it when End is set (a span), and an Absorb kind joins the open span, or the node just before it when that node is the rule's.
type Word ¶ added in v0.4.0
type Word struct{ Label, Tone string }
Word is how one event kind reads on a timeline.
type Words ¶ added in v0.4.0
type Words struct {
Kinds map[string]Word
Duration func(time.Duration) string
// Sub is the short value of an event a label's {{.sub}} reads, such as a review's verdict; nil for none.
Sub func(Event) string
}
Words are what Group reads beside the rules: each kind's words, a duration in words, and an event's sub.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package timelinetest holds an in-memory timeline.Reader.
|
Package timelinetest holds an in-memory timeline.Reader. |