timeline

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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 Pick

func Pick(recs map[unit.Unit]port.Event, id task.ID, held []unit.Unit) (port.Event, bool)

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

type Event struct {
	Seq int64
	port.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

type Filter struct {
	Kinds  []string
	Before int64
	Limit  int
}

Filter narrows a timeline: Kinds keeps those event kinds (every kind when empty), 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; 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
}

Merged is the Reader over the event log: a task's timeline is its own events and those of the units it holds.

func (Merged) Of

func (m Merged) Of(ctx context.Context, id task.ID, f Filter) ([]Event, error)

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.

Directories

Path Synopsis
Package timelinetest holds an in-memory timeline.Reader.
Package timelinetest holds an in-memory timeline.Reader.

Jump to

Keyboard shortcuts

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