Documentation
¶
Overview ¶
Package model is the learner model of api: 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.
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 History
- type Level
- type Log
- type Model
- func (m *Model) Before(log Log, moment time.Time, engineModules []string) (learnermodel.Readout, error)
- func (m *Model) Correct(ctx context.Context, tx pgx.Tx, profileID string, s Settled, ...) (Settled, error)
- func (m *Model) Goal(ctx context.Context, tx pgx.Tx, profileID string) ([]learnermodel.GoalItemSince, error)
- func (m *Model) Graphs(modules []string) learnermodel.Graphs
- func (m *Model) History(ctx context.Context, tx pgx.Tx, profileID string, ends []time.Time, ...) (History, error)
- func (m *Model) KeepHistory(ctx context.Context, tx pgx.Tx, profileID string, h History) error
- func (m *Model) Log(ctx context.Context, tx pgx.Tx, profileID string) (Log, error)
- func (m *Model) Look(ctx context.Context, tx pgx.Tx, profileID string) (Settled, error)
- func (m *Model) LookAndLog(ctx context.Context, tx pgx.Tx, profileID string) (Settled, Log, error)
- 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) Reads(digest string, journaled bool) bool
- func (m *Model) RepeatingTraps(journal []store.Entry) []Trap
- func (m *Model) SetGoal(ctx context.Context, tx pgx.Tx, profileID string, s Settled, ...) (Settled, 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: 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.
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 History ¶ added in v0.1.92
type History struct {
Now Settled
Weeks []Settled
At []Settled
// contains filtered or unexported fields
}
History is a profile's learner model for the history of the cognitive map: the state now, as Look gives it, the state at the end of each past week, by the moments the weeks end at, in their order, and the state at each of the other moments asked for, in their order, each read by the graphs and the grade of the state now.
type Level ¶ added in v0.1.59
Level is an adult's last correction of a module's level, as the journal holds it: the module, the ID of the band set, and when, in whole seconds.
type Log ¶ added in v0.1.92
type Log struct {
// contains filtered or unexported fields
}
Log is a profile's journal of evidence as the fold takes it, with the evidence its closed attempts owe after it, for replaying it up to a moment: the state at the end of a week of the history of the cognitive map, or at the start of the window of the indicators. It holds the graphs of the current versions of its modules and the learner's grade now, by which every moment is read.
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) Before ¶ added in v0.1.92
func (m *Model) Before(log Log, moment time.Time, engineModules []string) (learnermodel.Readout, error)
Before reads the state of log at the moment, by the records before it in the order of the log, against the graphs of the modules' current versions — the evidence of a skill a version retired goes to the skills that replaced it — and those of engineModules, with the learner's grade now: learner-model's ReplayBefore and then its Read at that moment. It refuses what Read refuses.
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: 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) Goal ¶ added in v0.1.92
func (m *Model) Goal(ctx context.Context, tx pgx.Tx, profileID string) ([]learnermodel.GoalItemSince, error)
Goal is the goal for the tutor of the profile's journal, read in tx: each item of its last goal set with the moment from which it has stood in the goal, learner-model's GoalBefore with no bound. A goal set that does not decode is left out, as the fold leaves it out.
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.
func (*Model) History ¶ added in v0.1.92
func (m *Model) History(ctx context.Context, tx pgx.Tx, profileID string, ends []time.Time, at ...time.Time) (History, error)
History reads, in tx, the profile's state now, its state at each of ends and at each of at, and writes nothing. A past week's state, and one at a moment of at, is learner-model's ReplayBefore of the log up to it, each replayed anew from the log, never folded on from another; the replays of the weeks are kept in a cache under a mark — the version of learner-model, the release of modules and the window of the format's versions, which give the current versions the log is read by —, the last evidence of the journal and the ends, and come from it while the four are the request's. Otherwise every week is replayed, and KeepHistory writes them. The states at the moments of at are never kept: they are replayed at each call.
The journal is read whole at most once: a cache of another mark or other ends tells the miss before it, and the log is read with the look, as it is whenever at names a moment; a cache of the request's mark and ends needs the look alone, which reads only the tail the cache of the state has not taken, unless the journal has gone on since, or the profile owes evidence, when the log is read after it. A log with evidence owed is replayed and not kept: that evidence has no number in the journal yet, by which the mark would know it. Nor is a cache of a later mark overwritten, which the image after this one wrote during a deployment.
func (*Model) KeepHistory ¶ added in v0.1.92
KeepHistory writes, in tx, the cache of the history h replayed, when it has one to write, under the rows HoldMapHistory holds: a profile deleted since writes none, and a cache of a later mark, which the image after this one wrote since, stays.
func (*Model) Log ¶ added in v0.1.92
Log reads, in tx, the profile's journal whole and the evidence its closed attempts owe, and writes nothing: the owed attempts stay owed and the cache stays as it was. It leaves out what the fold leaves out — a piece that does not decode, a goal set, the evidence of a package withdrawn for a wrong key, and an owed attempt whose evidence cannot be built —, so that replayed with no bound it gives the state Look gives.
func (*Model) Look ¶ added in v0.1.92
Look gives the profile's state as Settle would, read in tx and written nowhere: the cache as it is, with no row made or held, the tail of the journal, and the evidence each owed attempt would append, folded into the state in memory alone and given to its attempt by Closed. The owed attempts stay owed and the cache stays as it was; LastSeq is the journal's last, and Written is none. A request that may write nothing reads the model so, in a read-only snapshot, which neither holds the cache's row nor waits for it.
func (*Model) LookAndLog ¶ added in v0.1.92
LookAndLog gives what Look gives and what Log gives, of one reading of the journal: the journal whole, of which the look folds the tail the cache has not taken. A request that reads the state now and replays the log too reads the journal so, once.
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.
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.
func (*Model) Reads ¶ added in v0.1.92
Reads says whether the state reads the evidence of an attempt on the package of digest that gives evidence, journaled when the journal holds it: none of a package the index withdrew for a wrong key, and none owed on a package the image no longer holds, of which it would be built.
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. A trap whose last version left the image has no catalog to describe it by, and is left out. A goal set, of no attempt, and a row that does not decode count none: a row a later version of learner-model wrote may be one this one refuses, and it would otherwise refuse the progress.
func (*Model) SetGoal ¶ added in v0.1.92
func (m *Model) SetGoal(ctx context.Context, tx pgx.Tx, profileID string, s Settled, items []learnermodel.GoalItem, at time.Time) (Settled, error)
SetGoal appends a goal for the tutor set — its items in order, none when the goal is removed — at at, after the settled state s, to the profile's journal in tx, and writes the cache, as Correct does: the evidence learner-model's GoalSet gives, which moves no state, so the state after it is s with the number of its row. learner-model refuses more than three items, an item twice and an item that is no area or no full skill ID; whether an area is on the format's list, and a skill in a graph, is the caller's to check.
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. 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.
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. An adult's correction of a module's level is folded whatever its package: a wrong key makes no level the adult set wrong. A goal for the tutor set is no evidence of a skill and is left out, as learner-model moves nothing by it.
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, 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.
func (Settled) Closed ¶ added in v0.1.92
func (s Settled) Closed(closed []store.ClosedAttempt) []store.ClosedAttempt
Closed gives a copy of the closed attempts with the evidence a look folded into the state and wrote nowhere, where the journal has none yet, so that what reads their evidence reads what the settling would give; of a settling they are as they are.
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: 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.