model

package
v0.1.92 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 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: 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

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

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.

func TaskID

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

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.

func (History) Keeps added in v0.1.92

func (h History) Keeps() bool

Keeps says whether h has a cache to write.

type Level added in v0.1.59

type Level struct {
	Module string
	Band   string
	SetAt  time.Time
}

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.

func Levels added in v0.1.59

func Levels(ctx context.Context, db store.Lister, profileID, module string) ([]Level, error)

Levels is the adult's last correction of the level of the module of the profile's journal, or with module empty of each module that has one, connected or not since, in the order of the modules' IDs byte by byte.

func LevelsOf added in v0.1.59

func LevelsOf(journal []store.Entry) []Level

LevelsOf is Levels of a journal already read, whole, in its order: of its corrections, rows of no attempt that are no goal set.

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

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) 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

func (m *Model) KeepHistory(ctx context.Context, tx pgx.Tx, profileID string, h History) error

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

func (m *Model) Log(ctx context.Context, tx pgx.Tx, profileID string) (Log, error)

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

func (m *Model) Look(ctx context.Context, tx pgx.Tx, profileID string) (Settled, error)

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

func (m *Model) LookAndLog(ctx context.Context, tx pgx.Tx, profileID string) (Settled, Log, error)

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

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.

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.

func (*Model) Reads added in v0.1.92

func (m *Model) Reads(digest string, journaled bool) bool

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

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

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.

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.

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.

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: 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