model

package
v0.1.53 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 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 model is the learner model of api (R06, R08, R49): it builds the evidence of a closed attempt, appends it to the profile's journal, keeps the cache of the skill state that learner-model folds of the journal, and reads the state for the skill map. The journal is the truth, and the cache is learner-model's state under a mark: the version of learner-model, the release of modules and the window of the format's versions it was computed on.

Evidence is owed, rather than written by each close: Settle, under the lock of the profile's row of the cache, writes the evidence of every closed attempt of the profile that owes it, in the order they closed — those a request closed, and those the daily job, a trigger or the image before closed too (R49).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Describe

func Describe(pkg *modulepackage.Package, task formatv0.Task) (learnermodel.Task, error)

Describe is the task of the package as learner-model describes it, for the evidence of an attempt and for a candidate of the engine (R08): its full ID — a template's own —, its band and difficulty, its skills and those of its items, where its key and skill tags came from, and the kind of the check of each answer slot, with the number of options of a choice. Every key of a module is the author's, but a template's, which the program works out, and so are its skill tags (concepts 9.4 spec).

func IsAnchor

func IsAnchor(id string) bool

IsAnchor says whether a skill a module names is an anchor skill of the shared taxonomy.

func ModuleOfSkill added in v0.1.19

func ModuleOfSkill(skill string) string

ModuleOfSkill is the module of a skill's full ID: what comes before its kind.

func SkillID

func SkillID(module formatv0.ModuleID, id string) string

SkillID and TaskID are the full IDs of a skill and a task of a module, as the learner model, the engine and the progress know them: the module's ID, the kind and the local ID (concepts 3 spec).

func TaskID

func TaskID(module formatv0.ModuleID, id formatv0.TaskID) string

Types

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the learner model on the packages the image holds.

func New

func New(set *packages.Set, learnerModel string) (*Model, error)

New is the model of the packages of set, by the version of learner-model the binary is built with. A binary that recorded none is refused, since the mark of the cache names it, and so is a current version whose graph learner-model refuses: no state could be computed of it.

func (*Model) Graphs

func (m *Model) Graphs(modules []string) learnermodel.Graphs

Graphs gives each of the modules the graph of its current version, or no current version, whose evidence then waits in the journal (R08).

func (*Model) Mark added in v0.1.19

func (m *Model) Mark() store.Mark

Mark is the mark this image computes the cache on: the version of learner-model, the release of modules and the window of the format.

func (*Model) Owing

func (m *Model) Owing(ctx context.Context, db store.Lister, after string, n int) ([]string, error)

Owing is up to n of the profiles that owe evidence this image can build, by ID after the ID after: those with an attempt closed with no request after it — by the daily job, a trigger or the image before (R49).

func (*Model) Read

func (m *Model) Read(s Settled, at time.Time, engineModules []string) (learnermodel.Readout, error)

Read reads the settled state at at, against its graphs and those of the modules of the engine — the modules connected and fit for the learner — with the grade (R08).

func (*Model) RepeatingTraps

func (m *Model) RepeatingTraps(journal []store.Entry) ([]Trap, error)

RepeatingTraps is the traps the program found in two of the journal's attempts or more, by full ID, the most found first, then the latest. An attempt on a version withdrawn for a wrong key counts none: its verdicts are wrong (R63 spec). A trap whose last version left the image has no catalog to describe it by, and is left out (Д27).

func (*Model) Settle

func (m *Model) Settle(ctx context.Context, tx pgx.Tx, profileID string, at time.Time) (Settled, error)

Settle writes, in tx, the evidence the profile's closed attempts owe, and gives its state (R06, R49). It holds the profile's row of the cache, which numbers the evidence one piece after another, and takes the cache by its mark:

  • the mark this image works on: the tail of the journal the cache has not taken yet is appended first, in order;
  • an older one, or none, or a cache that does not decode: the state is recomputed of the whole journal;
  • a newer one — the image after this one, during a deployment, wrote it —: the state is recomputed for the answer, and the cache is not written (the 2026-11-02 amendment to R06).

Then each owed attempt's evidence is appended to the state and to the journal, with the start band the fold took. The evidence of a package withdrawn for a wrong key goes to the journal and not to the state, as the recomputing leaves it out, so that appending gives what recomputing does (R63 spec).

What cannot be read or built stops nothing: a piece of the journal that does not decode, or that the fold refuses, is left out of the state, as both ways of folding leave it out; an owed attempt whose evidence cannot be built, or that the fold refuses, stays owed and is not written, so that a fixed release builds it. One such attempt would otherwise refuse every close and every read of its profile.

func (*Model) Tell added in v0.1.21

func (m *Model) Tell(ctx context.Context, o store.Owed) (Told, error)

Tell is what the rows of the attempt o tell: its items of its answers alone, and the rest when the image holds its package — one that left the image tells no trap, technique or question (Д27).

type Settled

type Settled struct {
	State   learnermodel.State
	Graphs  learnermodel.Graphs
	Grade   learnermodel.Grade
	LastSeq int64
	Written int
}

Settled is a profile's state once its owed evidence is in its journal: the state, the graphs it was computed on, the learner's grade, which reading it needs, the number of the last evidence of the journal, which an engine's choice keeps (R06), and how many pieces of evidence the settling wrote.

type Told added in v0.1.21

type Told struct {
	Items      []learnermodel.ItemAnswer
	Traps      []string
	Techniques []string
	Question   string
	// Read says the package was in the image, so that the traps, the
	// techniques and the question were read: the items are read of the answers
	// alone.
	Read bool
}

Told is what an attempt's rows tell of it once the package of its version reads them, as its export gives it (R52; R135 spec): what came of each item, the traps the program found in its wrong values, the IDs of the task's techniques, and its leading question.

type Trap

type Trap struct {
	ID           string
	Description  string
	Advice       string
	Attempts     int
	LastClosedAt time.Time
}

Trap is a trap that repeats in a profile's closed attempts (contract, RepeatingTrap): its full ID, its description and advice from the trap catalog of the version of the last attempt that found it, how many attempts found it, and when the last of them closed.

Jump to

Keyboard shortcuts

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