Documentation
¶
Overview ¶
Package route holds the side gate and the read gate. The side gate places an item by the first rung that decides it: every sighting's tags, then a routing rule, then the quality gate, else review. A rule placed before the model always wins over it, so the model judges only what the rules leave. The quality gate's rung drops the item where the gate dropped it, sends it to review where the gate was unsure, and otherwise places it by the gate's side guess at or above its floor. Where a connector that sighted the item declares person_sorts, a guess places nothing and the item waits in review beside it. While the item's quality task is open, the side gate decides nothing, and the item waits at the quality gate. The read gate then chooses whether an item placed on a side is read as is or by a model: by its connector's read rule, else its side's default.
The side gate places an item only once the scan of its newest parse is done. The service runs both gates in the write that ends each stage after the parse and before the side gate, so a scan and its side decision commit together, and a parse's end places nothing. It runs them again in the write that applies a changed set, and in the write that adds a sighting to an item the store held. Each run leaves an item that a tag, a rule, a model or a person placed as it is. It decides again an item that the gate itself sent to review, or a model's guess below the floor, so a guess or a rule that arrives later reaches it. A person's placement from review runs the read gate the same way. Each decision is appended, and the newest at a gate decides. Each decision brings the item's delivery and its model read in line in the same write: a read as is queues its delivery, a read by a model queues its model read, and a drop or a move withdraws either where it has not run. The same write passes the item's decisions to each of its chapters, which no gate decides. A chapter's delivery waits for its book's to settle, and the write that settles the book's queues it.
Index ¶
- Constants
- Variables
- func AfterApply(log *slog.Logger) connectors.AfterApply
- func AfterDelivery(ctx context.Context, tx *store.Tx, task store.Task) error
- func AfterSighting(log *slog.Logger) func(context.Context, *store.Tx, string) error
- func AfterStage(log *slog.Logger) func(context.Context, *store.Tx, store.Task) error
- func BeforeModel(set connectors.Set, sightings []store.Sighting) (store.Decision, bool)
- func ByModel(run string) string
- func ByParent(key string) string
- func ByPerson(login string) string
- func Gate(ctx context.Context, tx *store.Tx, key string, log *slog.Logger) ([]store.Decision, error)
- func ModelReadDue(side, read store.Decision, outputs []store.Output, open bool) bool
- func PassToChapters(ctx context.Context, tx *store.Tx, key string) error
- func Place(ctx context.Context, tx *store.Tx, key string, p Placement) ([]store.Decision, error)
- func Provisional(d store.Decision) bool
- func QueueDelivery(ctx context.Context, tx *store.Tx, key string) (bool, error)
- func QueueUndeliveredChapters(ctx context.Context, tx *store.Tx) (int, error)
- func Read(set connectors.Set, sightings []store.Sighting, side string, note *string) store.Decision
- func ReadByModel(side, read store.Decision) bool
- func Side(set connectors.Set, sightings []store.Sighting, guess *Guess) store.Decision
- type ChapterError
- type DueDelivery
- type DueReader
- type Guess
- type NotDeclaredError
- type Placement
- type ReviewReason
Constants ¶
const ( VerdictReview = "review" VerdictDrop = "drop" )
The side gate's verdicts beyond the two sides. An item placed on a destination that takes no side is dropped, softly: it keeps its row.
const ( CauseTags = "tags" CauseTagsDisagree = "tags-disagree" CauseRule = "rule" CauseGuess = "guess" CauseBelowFloor = "below-floor" // CauseNoGuess sends to review an item that no tag or rule placed and // that the quality gate gave no answer for: its run failed, or no quality // task was queued. CauseNoGuess = "no-guess" // CauseGateError sends to review an item whose gate could not read the // set in force or the item's sightings. The item keeps its parse. CauseGateError = "gate-error" // CausePersonSorts sends to review an item that no tag or rule placed and // that a connector declaring person_sorts sighted, where the quality gate // passed it with a side guess. The review queue shows the guess beside it. CausePersonSorts = "person-sorts" // CauseQualityDrop drops an item that the quality gate dropped, and // CauseQualityReview sends to review one that it was unsure of. CauseQualityDrop = "quality-drop" CauseQualityReview = store.ReasonQualityReview // CauseConnector and CauseSideDefault are the read gate's. CauseConnector = "connector" CauseSideDefault = "side-default" // CauseUnstated is a person's placement that names no cause. CauseUnstated = "unstated" // CauseTitle and CauseTheme are a person's causes naming the item's title // or its theme. A person may also name a field of a sighting, such as // subreddit. CauseTitle = "title" CauseTheme = "theme" )
Causes that the gates write. A person's decision carries the aspect the person named instead, such as subreddit, channel, theme or title.
const ( ByTag = "tag" // ByGate is the side gate itself, where no rung placed the item. ByGate = "gate" )
Who decided, as decided_by spells it, beside rule:<name>, model:<run> and person:<login>.
const GuessFloor = 0.7
GuessFloor is the confidence at or above which the quality gate's personal guess places an item. A fleet guess places nothing at any confidence: a tag, a rule or a person puts an item on the fleet side, never a guess. Below the floor, and on a fleet guess, the item waits in review with its guess.
Variables ¶
var ErrNotDeclared = errors.New("the destination is not declared")
ErrNotDeclared is what a NotDeclaredError matches with errors.Is.
var ReviewReasons = []ReviewReason{ {store.ReasonQualityReview, "the quality gate sent it to review", "the gate asks"}, {CauseBelowFloor, "the quality gate guessed fleet, or its guess fell below its floor", "fleet guess, or below its floor"}, { CausePersonSorts, "a connector that sighted it declares person_sorts, so its guess only shows", "its connector leaves the side to you, the guess beside it", }, {CauseTagsDisagree, "its sightings' tags name destinations on two sides", "tags name both sides"}, {CauseNoGuess, "no tag or rule placed it, and the quality gate gave no answer", "no rule, no answer"}, {CauseGateError, "the side gate could not read the set in force or its sightings", "the gate could not read the set or the sightings"}, {store.ReasonNoParse, "no parse of it is usable", "no usable parse"}, }
ReviewReasons lists why an item may wait in review, in the order that the TUI groups them. The gate's own doubts lead, because the reading pane decides them best. review-list.schema.json's reason enum holds these names.
Functions ¶
func AfterApply ¶
func AfterApply(log *slog.Logger) connectors.AfterApply
AfterApply is the hook that serve runs in the write that applies a changed set. It runs the gates again over each scanned item that no side decision placed, so a rule the set adds places what it matches. It then reconciles the delivery of each item read as is that holds no settled delivery, so a side's default or a deliverer that the set adds reaches the items that waited for one.
func AfterDelivery ¶ added in v0.23.0
AfterDelivery is the hook that serve runs in the write that ends a deliver task done. It brings the delivery of each chapter of the task's item in line, so a book whose delivery settled queues its chapters' in that write, and a refused book queues none.
func AfterSighting ¶ added in v0.24.0
AfterSighting is the hook that serve's lander runs in the write that adds a sighting to an item the store held. It runs the gates over the item again, so a later sighting's tags, connector or fields decide an item that waits in review, and an item already placed stays where it is.
func AfterStage ¶
AfterStage is the hook that serve runs in the write that ends a task done. Where the task's stage comes after the parse and before the side gate, such as the scan, it runs the gates over the task's item.
func BeforeModel ¶
BeforeModel is the side decision that a sighting's tags or a routing rule make under set, and false where neither places the item, so the quality gate judges it.
func ByParent ¶ added in v0.20.0
ByParent is a decision that an item took from its parent, under the parent's key.
func Gate ¶
func Gate(ctx context.Context, tx *store.Tx, key string, log *slog.Logger) ([]store.Decision, error)
Gate runs the side gate over the item under key and, where it places the item on a side, the read gate, appending each decision. It answers the decisions it appended.
It runs only over an item whose newest done parse holds a done scan, so no item is placed before its scan. It leaves an item that a tag, a rule, a model or a person placed as it is, so a sighting that arrives after placement moves nothing. Where it decides again and answers what the item's newest side decision already says, it appends nothing.
Where it cannot read the set in force or the item's sightings, it sends the item to review as CauseGateError and logs why, so the scan stands and the next stage or apply runs the gate again.
func ModelReadDue ¶
ModelReadDue says whether a replay runs the model read on an item: its newest decisions read it by a model, under a lens whose prompt this build holds, no model read's task of it is open, and no done read of that lens's prompt in force answers the read decision's note. A read decision that the item took from its parent is never due, because a model read reads the item's own parse, and a book's chapter holds none.
func PassToChapters ¶ added in v0.20.0
PassToChapters gives each chapter of the item under key the item's newest side decision and, where it places the item on a side, its newest read decision, each decided by ByParent. It appends nothing to a chapter whose newest decisions already say the same. It then brings each chapter's delivery and model read in line, as decide does for the item. A chapter takes its decisions only from its parent, so the gates never run on it.
func Place ¶
Place appends a person's decision on the item under key: on p's destination, or a drop where p names none. Where the destination takes a side, the read gate's decision follows it. A person can place any item, including one that a rule already placed. A placement that repeats the newest side decision appends nothing, and answers the decisions it made. Place answers store.ErrNoItem where the store holds no such item, a NotDeclaredError for a destination that the set in force does not declare, and a ChapterError for a book's chapter.
func Provisional ¶
Provisional says whether a side decision waits on a later input: a review that the gate wrote for want of a rule or a guess, or for an error, and a model's review or drop. A rule that a later set adds, or a later answer of the quality gate, then decides the item again. Every other side decision, by a tag, a rule, a person or a model's confident guess, is final, and the quality gate never runs on its item again.
func QueueDelivery ¶
QueueDelivery brings the deliveries of the item under key, and of each of its chapters, in line with what Due answers for their newest decisions under the set in force. So a replay of one book reaches its chapters. It answers whether it queued a delivery.
func QueueUndeliveredChapters ¶ added in v0.23.0
QueueUndeliveredChapters queues the delivery of each chapter that holds none while its book's delivery settled on a record, and answers how many it queued. serve runs it once it listens. So the chapters of a book delivered before its deliverer wrote chapters reach the book's record, with no replay asked for.
func Read ¶
Read is the read gate's decision on an item placed on side: the read rule of the first connector that sighted it and declares one, else side's default. A model read takes side's lens, and carries note, the questions and why the item was saved, where a person wrote one.
func ReadByModel ¶
ReadByModel says whether an item's newest side and read decisions send it to a model read: the side decision places it on a side, and the read decision reads it by a model.
Types ¶
type ChapterError ¶ added in v0.20.0
ChapterError is a placement of a book's chapter. A chapter takes every decision from its book, so a placement of its own would be undone by the book's next one.
func (*ChapterError) Error ¶ added in v0.20.0
func (e *ChapterError) Error() string
type DueDelivery ¶ added in v0.23.0
type DueDelivery struct {
Destination connectors.Destination
Undelivered *connectors.Undelivered
Path *string
BookDestinationID string
}
DueDelivery is where Due sends an item: the destination whose deliverer writes it, or why none does. Path is the item's file below the deliverer's root, for a deliverer that writes by file. BookDestinationID is the destination's id for a chapter's book's record. Each is empty where the item reaches no deliverer, or where it does not apply.
func Due ¶
func Due(ctx context.Context, r DueReader, set connectors.Set, item store.Item, side, read store.Decision) (DueDelivery, bool, error)
Due is where an item's newest side and read decisions send it for delivery under set, and false where they send it nowhere: the side decision places it on no side, or the read decision reads it other than as is. It reads the item's live homes and its book's deliveries through r. A chapter names its book's record, so it is due only once its book's delivery to the same destination settled on one. The queue, a replay, an apply and items show each ask it.
type DueReader ¶ added in v0.23.0
type DueReader interface {
LiveHomes(ctx context.Context, sum string) ([]store.Home, error)
Deliveries(ctx context.Context, key string) ([]store.Delivery, error)
}
DueReader reads what Due decides from beside an item's decisions: its bytes' live homes, and its book's deliveries where it is a book's chapter. A write's Tx and the store's reader each are one.
type Guess ¶
type Guess struct {
// Side is personal, fleet or unsure.
Side string
Confidence float64
// Run names the model run that answered it.
Run string
}
Guess is the quality gate's side guess on an item.
type NotDeclaredError ¶
NotDeclaredError is a placement naming a destination that the set in force does not declare.
func (*NotDeclaredError) Error ¶
func (e *NotDeclaredError) Error() string
func (*NotDeclaredError) Is ¶
func (e *NotDeclaredError) Is(target error) bool
type Placement ¶
type Placement struct {
// Destination is where the item goes, one the set in force declares. A
// drop names none.
Destination string
// Cause is the aspect that decided it, such as subreddit, channel, theme
// or title. Empty is CauseUnstated.
Cause string
// Note is the questions and why the item was saved, which a model read
// answers.
Note *string
Login string
ClientID string
}
Placement is a person's decision on an item.
type ReviewReason ¶ added in v0.24.0
ReviewReason is one reason an item waits in review: its name, the line that `review list --help` gives it, and its group's heading in the TUI.