Documentation
¶
Overview ¶
Package waitnotice tells a person, once, that something entered the 「等我」 list, and reminds them once more if it stays there. It is the only sender of the 「等我」 notices: the desktop, webhook and Web Push channels all hang off Sender, so they cannot disagree.
The scan compares the current list with the waiting_notices rows and stamps the row where it sends, so a restart repeats nothing and skips nothing. A notice carries a title and a category, never the text of a turn.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Scanner ¶
type Scanner struct {
Store Store
Source Source
Sender Sender
ReminderAfter func() time.Duration
Now func() time.Time
// contains filtered or unexported fields
}
Scanner runs the comparison. ReminderAfter is read on every pass (0 = no reminder) so a config reload applies to the next one.
type Sender ¶
type Sender interface {
Send(Notice)
}
Sender delivers one notice on every channel. It must not block.
type Store ¶
type Store interface {
ListOpenWaitingNotices() ([]jobstore.WaitingNotice, error)
EnterWaitingNotice(caller, subjectKey, category string, at int64) (jobstore.WaitingNotice, bool, error)
MarkWaitingNotified(id, at int64) error
MarkWaitingReminded(id, at int64) error
ClearWaitingNotice(id, at int64) error
WaitingNoticesInitialized() (bool, error)
MarkWaitingNoticesInitialized(at int64) error
}
Store is the part of the job store the scan keeps its record in.
type Subject ¶
type Subject struct {
// Key is the subject key ("session:<id>", "job:<id>"); it is also the Web Push tag.
Key string
// Category is the 「等我」 category id (answer, approval ...).
Category string
// CallerID is the owner the notice goes to ("" = every caller that sees the project).
CallerID string
ProjectKey string
// Title is what the person knows the subject by: the seat name, the session title or the
// job title.
Title string
// ThreadID is the workbench thread the notice opens ("r:<sid>" for a terminal session).
ThreadID string
}
Subject is one entry of the 「等我」 list that a person is told about.