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 ¶
- func Describe(pkg *modulepackage.Package, task formatv0.Task) (learnermodel.Task, error)
- func IsAnchor(id string) bool
- func ModuleOfSkill(skill string) string
- func SkillID(module formatv0.ModuleID, id string) string
- func TaskID(module formatv0.ModuleID, id formatv0.TaskID) string
- type Level
- type Model
- func (m *Model) Correct(ctx context.Context, tx pgx.Tx, profileID string, s Settled, ...) (Settled, error)
- func (m *Model) Graphs(modules []string) learnermodel.Graphs
- func (m *Model) Mark() store.Mark
- func (m *Model) Owing(ctx context.Context, db store.Lister, after string, n int) ([]string, error)
- func (m *Model) Read(s Settled, at time.Time, engineModules []string) (learnermodel.Readout, error)
- func (m *Model) RepeatingTraps(journal []store.Entry) ([]Trap, error)
- func (m *Model) Settle(ctx context.Context, tx pgx.Tx, profileID string, at time.Time) (Settled, error)
- func (m *Model) Tell(ctx context.Context, o store.Owed) (Told, error)
- type Settled
- type Told
- type Trap
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 ¶
IsAnchor says whether a skill a module names is an anchor skill of the shared taxonomy.
func ModuleOfSkill ¶ added in v0.1.19
ModuleOfSkill is the module of a skill's full ID: what comes before its kind.
Types ¶
type Level ¶ added in v0.1.59
Level is an adult's last correction of a module's level, as the journal holds it (R89; R157 spec): the module, the ID of the band set, and when, in whole seconds.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the learner model on the packages the image holds.
func New ¶
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) Correct ¶ added in v0.1.59
func (m *Model) Correct(ctx context.Context, tx pgx.Tx, profileID string, s Settled, pkg *modulepackage.Package, band learnermodel.BandRef, at time.Time) (Settled, error)
Correct appends an adult's correction of the level of the module of pkg — its current version — to band, at at, to the settled state s and to the profile's journal in tx, and writes the cache, as Settle does (R89): the evidence learner-model's LevelCorrection gives, with the start band by the learner's grade, which every evidence of the module has. It gives the state after it. That the band is next to the level's is the caller's to check.
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
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 ¶
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 ¶
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 ¶
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). An adult's correction of a module's level is folded whatever its package: a wrong key makes no level the adult set wrong (R89).
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.
type Settled ¶
type Settled struct {
State learnermodel.State
Graphs learnermodel.Graphs
Grade learnermodel.Grade
LastSeq int64
Written int
// contains filtered or unexported fields
}
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. newerCache tells that the cache is of the image after this one, which this one does not write.
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.