Documentation
¶
Overview ¶
Package notes keeps meeting transcripts: the on-disk store of each room's last meeting, its Markdown rendering and expiry. The phrases come from the notes bot of the kunveno-notes add-on.
Index ¶
- Constants
- Variables
- func FileName(slug string, start time.Time, loc *time.Location) string
- func Lang(s string) string
- func Markdown(t Transcript, lang string, loc *time.Location) []byte
- func ParseKeep(s string) (time.Duration, error)
- func SummaryFileName(slug string, start time.Time, loc *time.Location) string
- func SummaryMarkdown(sm Summary, lang string, loc *time.Location) []byte
- type Event
- type Gone
- type Kept
- type Pending
- type Phrase
- type Store
- func (s *Store) Begin(slug, room string, start time.Time) error
- func (s *Store) Bytes() int64
- func (s *Store) Current(slug string) (int64, bool)
- func (s *Store) Delete(slug string) error
- func (s *Store) DeleteEnded(slug string, meeting int64) error
- func (s *Store) DeleteSummary(slug string, meeting int64) error
- func (s *Store) End(slug string, at time.Time) error
- func (s *Store) EndedAt(slug string, meeting int64) (int64, bool)
- func (s *Store) FailSummary(slug string, meeting, end int64) error
- func (s *Store) Has(slug string, meeting int64) bool
- func (s *Store) Latest(slug string) (int64, bool)
- func (s *Store) LatestSummary(slug string) (int64, bool)
- func (s *Store) List(slug string) []Kept
- func (s *Store) Load(slug string, meeting int64) (Transcript, error)
- func (s *Store) LoadSummary(slug string, meeting int64) (Summary, error)
- func (s *Store) Meeting(slug string) (time.Time, bool)
- func (s *Store) MeetingEndedAt(slug string, end int64) (int64, bool)
- func (s *Store) Pause(slug string, at time.Time) error
- func (s *Store) PendingSummaries() []Pending
- func (s *Store) Phrase(slug string, p Phrase) error
- func (s *Store) PutSummary(slug string, meeting, end int64, body []byte) error
- func (s *Store) Resume(slug string, at time.Time) error
- func (s *Store) SummaryMeetings(slug string) []int64
- func (s *Store) SummaryState(slug string, meeting int64) SummaryState
- func (s *Store) SummaryUntil(slug string, meeting int64) (time.Time, bool)
- func (s *Store) Sweep() []Gone
- func (s *Store) Until(slug string) (time.Time, bool)
- type Summary
- type SummaryState
- type Transcript
Constants ¶
const ( KindHeader = "header" KindPhrase = "phrase" KindPaused = "paused" KindResumed = "resumed" KindEnd = "end" )
Line kinds of a transcript file.
const MergeGap = 30 * time.Second
MergeGap: consecutive phrases of one speaker no further apart than this share a paragraph.
Variables ¶
var ( ErrBadSlug = errors.New("notes: bad room slug") ErrNoNotes = errors.New("notes: none ready for this room") ErrNotOpen = errors.New("notes: the room has no open transcript") // ErrRecording: the room's notes are still being recorded and cannot be deleted. ErrRecording = errors.New("notes: still being recorded") )
var ( ErrNoSummary = errors.New("notes: no summary for this meeting") // ErrStale: the meeting has no ready notes that ended at the given time. ErrStale = errors.New("notes: these notes are no longer the meeting's") )
Functions ¶
func Markdown ¶
func Markdown(t Transcript, lang string, loc *time.Location) []byte
Markdown renders a transcript: a title with the room, the date and time span with everyone who spoke, then one paragraph per run of one speaker and a line per pause or resumption (a pause at the very end is left out).
func ParseKeep ¶
ParseKeep reads notes.keep: a positive whole number and exactly one unit, m, h or d ("90m", "12h", "1d", "2d"). Anything else ("2d12h", "1w", "0d", "1.5h", "") is an error.
func SummaryFileName ¶ added in v0.6.0
SummaryFileName is the summary download's name: the room, the meeting's start and "summary".
Types ¶
type Kept ¶ added in v0.7.0
type Kept struct {
Meeting int64 // the meeting's start, Unix ms
Ended time.Time // when its notes ended
Until time.Time // until when they are kept
}
Kept describes one meeting's ready notes.
type Pending ¶ added in v0.6.0
type Pending struct {
Slug string
Meeting int64 // the meeting's start, Unix ms
End int64 // the notes' end, Unix ms
}
Pending names a meeting's ready notes that wait for a summary.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store keeps the transcript of every meeting of every room as dir/<slug>/<meeting>.jsonl, one JSON object per line, appended as the meeting goes; a restart loses nothing already written. Each transcript is kept for keep after it ends. Safe for concurrent use.
func Open ¶
Open reads the transcripts in dir (a missing dir holds none), after moving the files of the layout that kept only each room's last meeting (migrate.go). A file without an end line was cut off by a restart: it gets one at the time of its last line. A file that cannot be read is logged and skipped, left on disk as it is; only a failure to list dir is an error.
func (*Store) Begin ¶
Begin starts the transcript of a meeting that starts at start. The room's earlier meetings stay; a transcript of the same meeting (gone or expired meanwhile) is started again.
func (*Store) Current ¶ added in v0.7.0
Current returns the meeting the room's notes were last begun for; false when none.
func (*Store) Delete ¶
Delete removes everything the room keeps, for a deleted room. The room is forgotten even when its directory cannot be removed (the error is returned), so a room created again under the same slug never inherits the old notes while the server runs; Open reads what stayed after a restart, and it expires by its own end times.
func (*Store) DeleteEnded ¶ added in v0.3.3
DeleteEnded removes one meeting's ready notes at a person's request: ErrRecording while they are open, ErrNoNotes when there are none or they have expired. The meeting's summary stays. When the file cannot be removed the notes stay listed and the error is returned, so the request can be repeated.
func (*Store) DeleteSummary ¶ added in v0.6.0
DeleteSummary deletes the meeting's summary at a person's request, whether it is written, still pending or failed; the notes stay, and while they do no summary is written for them again. ErrNoSummary when there is nothing to delete.
func (*Store) End ¶
End closes the room's open transcript: it is ready for download until at plus keep.
func (*Store) EndedAt ¶ added in v0.6.0
EndedAt returns the end of the meeting's ready notes in Unix ms; false when there are none.
func (*Store) FailSummary ¶ added in v0.6.0
FailSummary records that the add-on gave up on the meeting's notes that ended at end, until a restart.
func (*Store) Has ¶ added in v0.7.0
Has reports whether the meeting still keeps notes (open or ready) or a summary.
func (*Store) LatestSummary ¶ added in v0.7.0
LatestSummary returns the room's newest meeting that has a summary in any state.
func (*Store) Load ¶
func (s *Store) Load(slug string, meeting int64) (Transcript, error)
Load reads the meeting's ready notes; ErrNoNotes when there are none to download.
func (*Store) LoadSummary ¶ added in v0.6.0
LoadSummary reads the meeting's stored summary; ErrNoSummary when there is none.
func (*Store) Meeting ¶ added in v0.4.0
Meeting returns the start of the meeting of the room's newest ready notes.
func (*Store) MeetingEndedAt ¶ added in v0.7.0
MeetingEndedAt finds the room's meeting whose ready notes ended at end.
func (*Store) PendingSummaries ¶ added in v0.6.0
PendingSummaries lists the ready notes with no summary that nobody deleted and the add-on has not given up on, by room and meeting.
func (*Store) PutSummary ¶ added in v0.6.0
PutSummary stores the summary of the meeting's ready notes that ended at end; ErrStale for any other notes or a summary a person deleted.
func (*Store) Resume ¶
Resume records that the notes were switched on again; it reopens the room's last transcript when it has ended.
func (*Store) SummaryMeetings ¶ added in v0.7.0
SummaryMeetings lists the room's meetings that have a summary in any state, newest first.
func (*Store) SummaryState ¶ added in v0.6.0
func (s *Store) SummaryState(slug string, meeting int64) SummaryState
SummaryState says what the meeting has of a summary.
func (*Store) SummaryUntil ¶ added in v0.6.0
SummaryUntil is until when the meeting shows its summary: a stored one until its expiry, a pending or failed one as long as its notes; false for SummaryNone.
type SummaryState ¶ added in v0.6.0
type SummaryState string
SummaryState is what a meeting has of a summary.
const ( SummaryNone SummaryState = "" // no summary and no ready notes waiting for one SummaryPending SummaryState = "pending" // ready notes, the summary not written yet SummaryReady SummaryState = "ready" SummaryFailed SummaryState = "failed" // the add-on gave up on these notes )