Documentation
¶
Overview ¶
Package keywrites runs the writes a tab's keys start: off the screen's loop, queued in the order the keys started them and run one at a time, on the strip while they run and on the footer once each ends, and awaited by quitting. It keeps each row a write is pending on until a read begun after the write shows it, so a tab refuses a second key on that row.
Index ¶
- type Ended
- type Pending
- type Write
- type Writes
- func (w *Writes) Await(announce func(doing []string)) []Ended
- func (w *Writes) Line(now time.Time) gotermboard.Line
- func (w *Writes) Pending(row string) (Pending, bool)
- func (w *Writes) PendingRows() map[string]Pending
- func (w *Writes) SayEnded()
- func (w *Writes) Settle(readFrom time.Time)
- func (w *Writes) Start(m *gotermboard.Model, write Write, reread func()) tea.Cmd
- func (w *Writes) Writing() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pending ¶
Pending is a row's newest write, from the key that queued it until a read begun after it ended lands, or for good where it failed. Running says it left the queue. Ended is when it landed, and Fault why it failed.
type Write ¶
Write is one write a key started. Row is the key of the one row the write acts on, which then stays pending, or empty for a write that reaches no one row.
type Writes ¶
type Writes struct {
// contains filtered or unexported fields
}
Writes is a tab's queue of writes. One runs at a time, because two on one row would each act on what the other moved. A key never waits on the queue, so the next key starts at once.
func (*Writes) Await ¶
Await waits for every write running or queued to end, then answers how each ended, in order. announce hears what it waits for before the wait starts, in the same step that finds them, so no write ends unheard between the two. Nothing under way returns nil and announces nothing. Quitting calls it, so the process never exits under a write half done or one a key queued and nothing ran.
func (*Writes) Line ¶
func (w *Writes) Line(now time.Time) gotermboard.Line
Line is the strip's line about the writes: what runs and for how long in yellow, red once it is overdue, with how many wait behind it, then what the newest did, for saidFor, or why it was refused in red. The footer says the whole answer when a write ends, so here an answer of several lines reads as one, and the screen's edge cuts it.
func (*Writes) PendingRows ¶
PendingRows is every row a write is pending on, by its key.
func (*Writes) SayEnded ¶
func (w *Writes) SayEnded()
SayEnded puts the newest ended write's whole answer on the footer, wrapped, which the strip's one line cuts. It runs as the frame is built, on the screen's loop.
func (*Writes) Settle ¶
Settle lets go of every row whose write landed before a read that began at readFrom, because that read shows what the write did. A failed row stays until the next write on it.