route

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 14 Imported by: 1 module, 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 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 routing rule is one that the set in force declares, or one that a person accepted. A seeded share of an accepted rule's items waits in review instead, marked rule-would-hide. A rule placed before the model always wins over it: the gate answers a ruled item too, and its answer moves nothing. The quality gate's rung sends to review an item that the gate dropped, marked gate-would-drop, unless every family of the item has earned hiding it, where it drops the item. It sends to review an item that the gate was unsure of, 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, an item that no tag or rule placed waits at the quality gate, and the side gate decides nothing. 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

View Source
const (
	VerdictReview = store.VerdictReview
	VerdictDrop   = store.VerdictDrop
	VerdictSplit  = store.VerdictSplit
)

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.

View Source
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"
	// CauseOwnersWords sends to review an item that no tag or rule placed and
	// that holds the owner's own words, as store.Item.SkipsQualityGate names
	// one. The quality gate never reads it, so no guess can place it.
	CauseOwnersWords = "owners-words"
	// CauseTopics splits a memo once its topics are landed, each an item that
	// the gates place on its own. Its verdict is VerdictSplit.
	CauseTopics = store.CauseTopics
	// CauseGateWouldDrop sends to review an item that the quality gate
	// dropped, where a family of the item has not earned hiding it.
	// CauseQualityDrop drops one that every family's trust hides, and keeps its
	// row. CauseQualityReview sends to review one that the gate was unsure of.
	CauseGateWouldDrop = "gate-would-drop"
	CauseQualityDrop   = "quality-drop"
	CauseQualityReview = store.ReasonQualityReview
	// CauseRuleWouldHide sends to review an item that a routing rule would
	// have dropped or placed, where the rule's review share drew it.
	CauseRuleWouldHide = "rule-would-hide"
	// 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, CauseTheme, CauseChannel and CauseLowQuality are a person's
	// causes naming the item's title, its theme, the channel that published
	// it, or that it held nothing worth keeping. A person may also name a
	// field of a sighting, such as subreddit.
	CauseTitle      = "title"
	CauseTheme      = "theme"
	CauseChannel    = "channel"
	CauseLowQuality = "low-quality"
	// CausePush is a person's push that named its destination, at the side
	// gate and at the read gate.
	CausePush = "push"
	// CauseNoteDraft is a read by a model whose note is the note stage's
	// draft: the model's own where the draft reached the note floor, and a
	// person's where they took a draft that fell below it. CauseNoteUnclear
	// sends to review an item whose draft fell below the floor.
	CauseNoteDraft   = "note-draft"
	CauseNoteUnclear = "note-unclear"
	// CauseLearningRefused sends to review, at the read gate, an item that a
	// person sorted to learning where the quality gate's newest answer did
	// not pass it. CauseShelfOpen is a person's opening of a shelved item,
	// and CauseShelfRemove their taking it off the shelf.
	CauseLearningRefused = "learning-refused"
	CauseShelfOpen       = store.CauseShelfOpen
	CauseShelfRemove     = store.CauseShelfRemove
)

Causes that the gates write. A person's decision carries the aspect the person named instead, such as subreddit, channel, theme or title.

View Source
const (
	ByTag = store.DecidedByTag
	// ByGate is the side gate itself, where no rung placed the item.
	ByGate = store.DecidedByGate
)

Who decided, as decided_by spells it, beside rule:<name>, model:<run> and person:<login>.

View Source
const (
	VerbFleetRelate        = "fleet-relate"
	VerbLearning           = "learning"
	VerbPersonalRelate     = "personal-relate"
	VerbPersonalSummarize  = "personal-summarize"
	VerbTechnicalSummarize = "technical-summarize"
	VerbWatch              = "watch"
)

The sort verbs, each a route that a person's sort in the review tab takes. Drop is not one of them: the drop route takes it, with its cause.

View Source
const (
	LensFleet    = connectors.SideFleet
	LensPersonal = connectors.SidePersonal
	LensLearning = "learning"
)

The lenses that a verb reads an item through.

View Source
const (
	LearningDeliverer = "learning-resources"
	WatchDeliverer    = "ypl-watch"
)

The deliverers whose destination a verb places an item on, as each registers its name.

View Source
const (
	// ShelfWaiting is an item on the shelf that nobody opened.
	ShelfWaiting = store.ShelfWaiting
	// ShelfOpened is a relate that a person opened, which runs on their
	// machine and keeps nothing in the service.
	ShelfOpened = store.ShelfOpened
	// ShelfReading, ShelfDone and ShelfFailed are a summary's model read
	// once a person opened it: queued or running, kept, and failed.
	ShelfReading = "reading"
	ShelfDone    = "done"
	ShelfFailed  = "failed"
)

The states of a shelved item, as the shelf answers them.

View Source
const DefaultNoteFloor = 0.7

DefaultNoteFloor is the confidence at or above which a note's draft becomes the read's note, where serve's [note] floor names none. Below it, the item waits in review as note-unclear.

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

View Source
var ErrNoRule = errors.New("no routing rule of that name was accepted")

ErrNoRule is a retirement of a rule that no person accepted.

View Source
var ErrNotDeclared = errors.New("the destination is not declared")

ErrNotDeclared is what a NotDeclaredError matches with errors.Is.

View Source
var ErrUnknownVerb = errors.New("the verb is none that a sort takes")

ErrUnknownVerb is a sort naming no verb of Verbs.

View Source
var ReviewReasons = []ReviewReason{
	{store.ReasonQualityReview, "the quality gate sent it to review", "the gate asks"},
	{
		CauseGateWouldDrop, "the quality gate would drop it, and its family has not earned hiding it, or the family's draw showed it",
		"the gate would drop it",
	},
	{
		CauseRuleWouldHide, "a routing rule would drop it or place it without you, and the rule's review share drew it",
		"a rule would decide it",
	},
	{
		CauseNoteUnclear, "a model read waits on its note, whose draft fell below the note floor: write a note, or place it with none to take the draft",
		"the note's draft is unclear",
	},
	{
		CauseLearningRefused, "you sorted it to learning, and the quality gate's newest answer did not pass it: its card holds the gate's reason",
		"learning refused it",
	},
	{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",
	},
	{CauseOwnersWords, "it holds your own words, such as a memo's topic, which the quality gate never reads", "your own words"},
	{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.

View Source
var Verbs = []VerbRoute{
	{
		Verb: VerbFleetRelate, Side: connectors.SideFleet, Read: connectors.ReadModel, Lens: LensFleet,
		Help: "a model reads it under the fleet lens against your current work, after a note's draft, and keeps its suggestion",
	},
	{
		Verb: VerbLearning, Side: connectors.SidePersonal, Deliverer: LearningDeliverer, Read: connectors.ReadAsIs, NeedsPass: true,
		Help: "delivered to the learning plan where the quality gate's newest answer passes it, and back in review as " + CauseLearningRefused + " otherwise",
	},
	{
		Verb: VerbPersonalRelate, Side: connectors.SidePersonal, Read: store.VerdictShelf, OpensHere: true,
		Help: "shelved: nothing runs until you open it, which hands its parse to psyche relate on your machine",
	},
	{
		Verb: VerbPersonalSummarize, Side: connectors.SidePersonal, Read: store.VerdictShelf, Lens: LensPersonal,
		Help: "shelved: nothing runs until you open it, which summarizes it once under the personal lens and keeps the summary",
	},
	{
		Verb: VerbTechnicalSummarize, Side: connectors.SidePersonal, Read: store.VerdictShelf, Lens: LensLearning,
		Help: "shelved: nothing runs until you open it, which summarizes it once under the learning lens and keeps the summary",
	},
	{
		Verb: VerbWatch, Side: connectors.SidePersonal, Deliverer: WatchDeliverer, Read: connectors.ReadAsIs,
		Help: "added to a playlist at its source to watch, the one you pick or the service's default",
	},
}

Verbs is every sort verb, in the order the review tab binds them.

Functions

func AcceptRule added in v0.34.0

func AcceptRule(ctx context.Context, tx *store.Tx, r store.RoutingRule, log *slog.Logger) (store.RoutingRule, bool, error)

AcceptRule appends r as its name's newest version, unless the newest already says the same by the same hand. Then, whether it appended or not, it runs the gates again as regate does for the rule, so a write sent again after a failed gate decides what the first could not. It answers the newest version and whether it appended one, and a *RuleError where the set in force refuses r.

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

func AfterDelivery(ctx context.Context, tx *store.Tx, task store.Task) error

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 AfterDraft added in v0.32.0

func AfterDraft(floor float64) func(context.Context, *store.Tx, store.Task) error

AfterDraft is the hook that serve runs in the write that ends a note task done. Where the item's newest read still waits on a draft, it appends the read gate's decision on the newest done draft: a read by a model of the draft, as note-draft, where its confidence reaches floor, and a review, as note-unclear, below it. That decision then brings the item's model read and its chapters in line. A read that a person's note or placement decided while the draft ran is left as it is.

func AfterSighting added in v0.24.0

func AfterSighting(log *slog.Logger) func(context.Context, *store.Tx, string) error

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

func AfterStage(log *slog.Logger) func(context.Context, *store.Tx, store.Task) error

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

func BeforeModel(set connectors.Set, accepted []store.RoutingRule, key string, sightings []store.Sighting) (store.Decision, bool)

BeforeModel is the side decision on the item under key that a sighting's tags or a routing rule make, under set and each accepted rule in force, and false where neither places the item, so the quality gate judges it.

func ByModel

func ByModel(run string) string

ByModel is a model's decision, under the run that answered.

func ByParent added in v0.20.0

func ByParent(key string) string

ByParent is a decision that an item took from its parent, under the parent's key.

func ByPerson

func ByPerson(login string) string

ByPerson is a person's decision, under their login.

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

func ModelReadDue(side, read store.Decision, outputs []store.Output, open bool) bool

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, the read waits on no note's draft, no model read's task of it is open, and no done read of that lens's prompt in force over the item's reading parse answers the read'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 NoteOf added in v0.32.0

func NoteOf(read store.Decision, draft *store.Output) (*string, bool)

NoteOf is the note that a model read under read answers, and whether a model drafted it: the person's note where read carries one, the note of draft, the item's newest done draft, where read took it, and nil otherwise. A draft never reaches a decision's note, so a read takes it by its cause.

func PassToChapters added in v0.20.0

func PassToChapters(ctx context.Context, tx *store.Tx, key string) error

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

func Place(ctx context.Context, tx *store.Tx, key string, p Placement) ([]store.Decision, error)

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 placement with no note of an item that holds a note's draft takes the draft, so its read by a model answers the draft, as the person's decision. 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. A placement on a destination of an item whose drop the gate showed or hid disagrees with the gate, which returns each family of its answer to rung 0. Place answers store.ErrNoItem where the store holds no such item, a NotDeclaredError for a destination that the set in force does not declare, a PushOnlyError for a push-only destination that p does not push to, a PlaylistDestinationError for a destination that only a sort places on, and a ChapterError for a book's chapter.

func QueueDelivery

func QueueDelivery(ctx context.Context, tx *store.Tx, key string) (bool, error)

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

func QueueUndeliveredChapters(ctx context.Context, tx *store.Tx) (int, error)

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

func Read(set connectors.Set, sightings []store.Sighting, side string, note *string) store.Decision

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

func ReadByModel(side, read store.Decision) bool

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.

func RedraftAfterAnswer added in v0.36.0

func RedraftAfterAnswer(ctx context.Context, tx *store.Tx, task store.Task) error

RedraftAfterAnswer is the hook that serve runs in the write that ends a quality task done, after the gate's decision. It acts where the read gate decided the item's read from a note's draft over a parse other than the item's reading parse, and the item stands on a side. There it appends the read that the side calls for again, which waits on a draft, and queues the draft. So once the gate answers over a new parse, the read is decided from a draft over the same parse. A read that a person decided stays as it is. So does an item that a model already read under the lens, which a model read's replay reads again.

func RemoveShelved added in v0.35.0

func RemoveShelved(ctx context.Context, tx *store.Tx, key, login, clientID string) (removed bool, err error)

RemoveShelved takes the shelved item under key off the shelf for the person under login, by a read decision that keeps the newest read's verdict, lens and note under cause shelf-remove. So a summary's model read already queued runs on, and a kept summary stays in the item's outputs. A removal of an item that a removal already took off answers false and appends nothing. It answers store.ErrNoItem and a NotShelvedError.

func RetireRule added in v0.34.0

func RetireRule(ctx context.Context, tx *store.Tx, name, decidedBy string, clientID *string, log *slog.Logger) (store.RoutingRule, bool, error)

RetireRule appends a retired copy of the newest version of the rule called name, by decidedBy from clientID, which takes the rule out of force. It appends nothing where the rule is retired already. Either way it then runs the gates again as regate does for the rule, so each item that the rule dropped, or that its share sent to review, is decided again without it. An item that it placed on a destination stays there. It answers ErrNoRule where no version of name was accepted.

func ShelfVerbs added in v0.35.0

func ShelfVerbs() []string

ShelfVerbs is each verb that puts an item on the shelf, in order.

func Side

func Side(set connectors.Set, accepted []store.RoutingRule, key string, sightings []store.Sighting, guess *Guess) store.Decision

Side is the side gate's decision on the item under key that sightings sighted, under set, each accepted rule in force, and the quality gate's guess, which is nil where it has given none.

func SortItem added in v0.35.0

func SortItem(ctx context.Context, tx *store.Tx, key string, s Sort) ([]store.Decision, error)

SortItem appends a person's sort of the item under key by s's verb: its side decision, under the verb as its cause, and its read decision, decided by the person under the verb too. Fleet relate reads it by a model under the fleet lens, after a note's draft, and takes a draft already done. Learning reads it as is where the quality gate's newest decision passes it, and otherwise sends it to review at the read gate as learning-refused, decided by the gate's run. Watch reads it as is, and keeps the playlist on its side decision for the delivery. A watch whose item's delivery already holds another playlist is refused, since a delivery adds the video to one. A shelf verb reads it by nothing until a person opens it. A sort that repeats the newest side decision, playlist included, appends nothing. A sort of an item whose drop the gate showed or hid disagrees with the gate, as a placement does. It answers what Place answers, a VerbRefusedError, and ErrUnknownVerb.

func VerbNames added in v0.35.0

func VerbNames() []string

VerbNames is each verb's name, in order.

Types

type ChapterError added in v0.20.0

type ChapterError struct {
	Chapter string
	Book    string
}

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 Draft added in v0.32.0

type Draft struct {
	Questions  []string `json:"questions"`
	WhySaved   string   `json:"why_saved"`
	Confidence float64  `json:"confidence"`
}

Draft is what the read gate reads of the note stage's answer, as prompts/note/answer.schema.json holds it: the questions for a model read to answer, why the item was likely saved, and how sure the draft is.

func DraftOf added in v0.32.0

func DraftOf(o store.Output) (Draft, error)

DraftOf decodes the draft that the note stage's output o answered.

func (Draft) Note added in v0.32.0

func (d Draft) Note() string

Note is the draft as the note that a model read answers: its questions, then why the item was likely saved.

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.

func GuessOf

func GuessOf(outputs []store.Output) *Guess

GuessOf is the side guess of the quality gate's newest done output among outputs, and nil where that output holds none. The side gate places by it, and the review queue shows it.

type NotDeclaredError

type NotDeclaredError struct {
	Destination string
	Declared    []string
}

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 NotShelvedError added in v0.35.0

type NotShelvedError struct{ Key string }

NotShelvedError is an opening or removal of an item that is not on the shelf.

func (*NotShelvedError) Error added in v0.35.0

func (e *NotShelvedError) Error() string

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
	// Pushed is a push that named its destination, whose cause is CausePush.
	// The person decides the read too, as is, so no model stage reads the
	// item whatever its connector's read rule or its side's default.
	Pushed   bool
	Login    string
	ClientID string
	// Presented is the review card as drawn when the person decided, and
	// DecidedAfterMS how long after the drawing they decided. The side
	// decision keeps both, and the read decision after it neither.
	Presented      *store.Presented
	DecidedAfterMS *int64
}

Placement is a person's decision on an item.

type PlaylistDestinationError added in v0.35.0

type PlaylistDestinationError struct {
	Destination string
	// Verb is the verb whose sort places an item there.
	Verb string
}

PlaylistDestinationError is a placement on a destination whose deliverer adds the item to the playlist that a sort picks, which no placement carries.

func (*PlaylistDestinationError) Error added in v0.35.0

func (e *PlaylistDestinationError) Error() string

type PushOnlyError added in v0.31.0

type PushOnlyError struct {
	Destination string
}

PushOnlyError is a placement other than a push on a push-only destination, whose program only a push hands the item to.

func (*PushOnlyError) Error added in v0.31.0

func (e *PushOnlyError) Error() string

type ReviewReason added in v0.24.0

type ReviewReason struct {
	Name    string
	Help    string
	Heading string
}

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.

type RuleError added in v0.34.0

type RuleError struct {
	Name     string
	Problems []string
}

RuleError is an accepted rule that the set in force refuses, with each reason.

func (*RuleError) Error added in v0.34.0

func (e *RuleError) Error() string

type Shelved added in v0.35.0

type Shelved struct {
	Verb string
	// Lens is the lens through which opening it reads the item, and empty
	// for a relate.
	Lens string
	// OpensHere says opening it runs its verb on the machine that opens it.
	OpensHere bool
	State     string
	Side      store.Decision
	Read      store.Decision
	Opened    *store.Decision
	ReadDone  *store.Output
	// Error is why the newest model read under the lens failed, where State
	// is failed: its output's error, else its task's.
	Error *string
}

Shelved is one item on the shelf, as its records stand.

func OpenShelved added in v0.35.0

func OpenShelved(ctx context.Context, tx *store.Tx, key, login, clientID string) (s Shelved, opened bool, err error)

OpenShelved opens the shelved item under key for the person under login, and answers where it stands after. The first opening appends the person's read decision as shelf-open: a read by a model under the shelf's lens for a summary, which queues its model read, and the shelf again for a relate, which runs on the person's machine. A later opening appends nothing and queues nothing, so a summary runs once and a second opening shows the kept one with no model call. A failed read runs again only through a retry of its task, which dispatches it under a new key. opened says whether this call opened it. It answers store.ErrNoItem and a NotShelvedError.

func ShelfOf added in v0.35.0

func ShelfOf(r store.ItemRecords) (Shelved, bool)

ShelfOf is where the item stands on the shelf, and false where it is off it, as store.ItemRecords.ShelfStanding decides. Its verb is its side decision's cause, and its lens its read decision's. An opened summary's state follows its model read under that lens.

type Sort added in v0.35.0

type Sort struct {
	Verb string
	// Playlist is the playlist that a watch adds the video to, and
	// DefaultPlaylist the one it takes where Playlist is empty.
	Playlist, DefaultPlaylist string
	Login, ClientID           string
	// Presented and DecidedAfterMS are a Placement's.
	Presented      *store.Presented
	DecidedAfterMS *int64
}

Sort is a person's sort of an item by one verb.

type VerbRefusedError added in v0.35.0

type VerbRefusedError struct {
	Verb string
	Why  string
}

VerbRefusedError is a sort that its verb cannot carry out on the item: no destination of the set in force takes the verb, the destination's deliverer cannot take the item, a watch names no playlist, or the item's delivery already holds another playlist.

func (*VerbRefusedError) Error added in v0.35.0

func (e *VerbRefusedError) Error() string

type VerbRoute added in v0.35.0

type VerbRoute struct {
	Verb      string
	Side      string
	Deliverer string
	Read      string
	Lens      string
	// NeedsPass sends the item back to review as learning-refused, rather
	// than reading it, where the quality gate's newest answer did not pass it.
	NeedsPass bool
	// OpensHere says opening a shelved item runs the verb on the machine that
	// opens it, and nothing in the service.
	OpensHere bool
	// Help is the verb's line in the CLI's help and the review tab's keys.
	Help string
}

VerbRoute is what one verb does with an item: the side it places it on, the deliverer whose destination it places it on, or the side's fleet destination, or none, and how it is read then. Read is as-is, model or shelf. A shelf's Lens is the lens through which opening it reads the item, and empty where opening runs nothing in the service.

func VerbOf added in v0.35.0

func VerbOf(name string) (VerbRoute, bool)

VerbOf is the verb named name, and false where none is.

func (VerbRoute) Destination added in v0.35.0

func (v VerbRoute) Destination(set connectors.Set) (destination *connectors.Destination, missing string)

Destination is where the verb places an item under set: the first destination whose deliverer is the verb's, or, for fleet relate, the fleet side's default, else its first. A push-only destination is never one. A shelf places on none, so it answers nil. missing says why the verb places nothing, where set declares no destination it takes.

func (VerbRoute) Shelves added in v0.35.0

func (v VerbRoute) Shelves() bool

Shelves says whether the verb puts an item on the shelf.

func (VerbRoute) TakesPlaylist added in v0.35.0

func (v VerbRoute) TakesPlaylist() bool

TakesPlaylist says whether the verb's deliverer adds the item to a playlist that the sort picks.

Jump to

Keyboard shortcuts

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