Documentation
¶
Overview ¶
Package catalog is api's way from a module to its package, in the contract novatrail.api.v1: PackageService, the open views of a package by its digest and which digests the image still gives; ModuleService, the catalog of a profile and the modules connected to it; and the files of the device parts, by HTTP GET, which are no method of Connect. All of it is read from the packages serve read at its start, packages.Set, and the open views are built once, there: a request reads them, and a package whose views do not build is a failed start.
Index ¶
- Constants
- type Catalog
- type DB
- type ModuleService
- func (s *ModuleService) ConnectModule(ctx context.Context, req *v1.ConnectModuleRequest) (*v1.ConnectModuleResponse, error)
- func (s *ModuleService) DisconnectModule(ctx context.Context, req *v1.DisconnectModuleRequest) (*v1.DisconnectModuleResponse, error)
- func (s *ModuleService) ListCatalog(ctx context.Context, req *v1.ListCatalogRequest) (*v1.ListCatalogResponse, error)
- func (s *ModuleService) ListConnectedModules(ctx context.Context, req *v1.ListConnectedModulesRequest) (*v1.ListConnectedModulesResponse, error)
- func (s *ModuleService) ListCourses(ctx context.Context, req *v1.ListCoursesRequest) (*v1.ListCoursesResponse, error)
- func (s *ModuleService) SetTaskSkill(ctx context.Context, req *v1.SetTaskSkillRequest) (*v1.SetTaskSkillResponse, error)
- type PackageService
- func (s *PackageService) CheckPackages(_ context.Context, req *v1.CheckPackagesRequest) (*v1.CheckPackagesResponse, error)
- func (s *PackageService) GetExamples(ctx context.Context, req *v1.GetExamplesRequest) (*v1.GetExamplesResponse, error)
- func (s *PackageService) GetManifest(ctx context.Context, req *v1.GetManifestRequest) (*v1.GetManifestResponse, error)
- func (s *PackageService) GetSkillGraph(ctx context.Context, req *v1.GetSkillGraphRequest) (*v1.GetSkillGraphResponse, error)
- func (s *PackageService) GetTechniques(ctx context.Context, req *v1.GetTechniquesRequest) (*v1.GetTechniquesResponse, error)
Constants ¶
const FilesPattern = "GET /packages/{package}/device/{path...}"
FilesPattern is the route of the files of the device parts: sha256-<hex> of the package, then the path of the file in its device part — LICENSE, NOTICE or media/<path>.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is the packages of the image with the open views of each.
func New ¶
New is the catalog of set, with the open views of each of its packages built by module-kit, by the marks x-open of the format.
func (*Catalog) Files ¶
Files is the handler of FilesPattern. It goes with no token, so that fetch sends it with no preflight and through the HTTP cache:
- 200, the file, by http.ServeContent — HEAD, ranges, and 304 by its ETag, the file's own digest — kept for a day;
- 404, a digest that is not one, or a path the device part does not have;
- 410, a package the image no longer gives: withdrawn, or out of the window;
- 503 with Retry-After, a digest the index of the image does not know.
No refusal has a body or is kept. Each answer writes its line of the log, with its status and time and nothing of its path.
func (*Catalog) Modules ¶
func (c *Catalog) Modules(db DB) *ModuleService
Modules is the ModuleService of the catalog, on db.
func (*Catalog) Packages ¶
func (c *Catalog) Packages() *PackageService
Packages is the PackageService of the catalog.
type DB ¶
DB is what ModuleService reads and writes the modules of a profile in: the pool of the database api.
type ModuleService ¶
type ModuleService struct {
// contains filtered or unexported fields
}
ModuleService gives the modules of a learner: each method is a learning request, with the right can_learn, which the checks hold before it, and a profile whose consent is not confirmed is refused. A module suits a learner by the audience of its current version alone: the explanation language chooses nothing.
func (*ModuleService) ConnectModule ¶
func (s *ModuleService) ConnectModule(ctx context.Context, req *v1.ConnectModuleRequest) (*v1.ConnectModuleResponse, error)
ConnectModule connects a module that the index names and whose current version suits the profile. A module connected already stays as it is, and its repeat gets the same answer, the modules connected, even when the module has lost its current version meanwhile: the request repeats by the profile's state.
func (*ModuleService) DisconnectModule ¶
func (s *ModuleService) DisconnectModule(ctx context.Context, req *v1.DisconnectModuleRequest) (*v1.DisconnectModuleResponse, error)
DisconnectModule disconnects a module; one not connected changes nothing. The evidence of the module stays in the profile's journal. The answer is the modules connected.
func (*ModuleService) ListCatalog ¶
func (s *ModuleService) ListCatalog(ctx context.Context, req *v1.ListCatalogRequest) (*v1.ListCatalogResponse, error)
ListCatalog gives the modules of the pinned index whose current version suits the profile and which the deployment's list names, when it has one, connected ones too, by their IDs. An ID is lowercase ASCII by the format's schema, so the order of its bytes is that of its UTF-16 code units, as the contract asks.
func (*ModuleService) ListConnectedModules ¶
func (s *ModuleService) ListConnectedModules(ctx context.Context, req *v1.ListConnectedModulesRequest) (*v1.ListConnectedModulesResponse, error)
ListConnectedModules gives the modules connected to the profile, in the order they were connected, each with the digest of its current version, or with none when it has none for the learner.
func (*ModuleService) ListCourses ¶ added in v0.1.87
func (s *ModuleService) ListCourses(ctx context.Context, req *v1.ListCoursesRequest) (*v1.ListCoursesResponse, error)
ListCourses gives the courses of the pinned index by their current versions, each with those of its grades whose module ListCatalog gives the profile, from the lowest, as the course orders them; a course left with no grade is not given. A course's ID is lowercase ASCII, as a module's is, so the order of its bytes is that of its UTF-16 code units.
func (*ModuleService) SetTaskSkill ¶ added in v0.1.84
func (s *ModuleService) SetTaskSkill(ctx context.Context, req *v1.SetTaskSkillRequest) (*v1.SetTaskSkillResponse, error)
SetTaskSkill sets the task skill of a connected module, a skill of the graph of its current version for the learner, or gives the choice back to the tutor with none. A module not connected, or a skill its graph does not have, is "not found"; a module with no current version is refused so; a module solved on the sheet, whose tasks the engine chooses none of, is malformed. A repeat sets the same skill: the request repeats by the profile's state.
type PackageService ¶
type PackageService struct {
apiv1connect.UnimplementedPackageServiceHandler
// contains filtered or unexported fields
}
PackageService gives what a package gives by its digest: the open views of its manifest, skill graph, technique catalog and example tasks, which go without a token by Connect GET and are cached for a day, and which digests the image still gives. GetSolvingSteps, which no screen asks any more, answers unimplemented: the checks before the handler know it not.
func (*PackageService) CheckPackages ¶
func (s *PackageService) CheckPackages(_ context.Context, req *v1.CheckPackagesRequest) (*v1.CheckPackagesResponse, error)
CheckPackages gives each digest of the request, in its order, with whether the image gives it. api keeps none of them, as the contract asks.
func (*PackageService) GetExamples ¶ added in v0.1.87
func (s *PackageService) GetExamples(ctx context.Context, req *v1.GetExamplesRequest) (*v1.GetExamplesResponse, error)
GetExamples gives the example tasks the package's manifest names, in its order: none when it names none. An example is no attempt, so the request writes nothing and names no profile.
func (*PackageService) GetManifest ¶
func (s *PackageService) GetManifest(ctx context.Context, req *v1.GetManifestRequest) (*v1.GetManifestResponse, error)
GetManifest gives the open view of the package's manifest, with how many tasks the package holds, in all and by skill, and how many lessons.
func (*PackageService) GetSkillGraph ¶
func (s *PackageService) GetSkillGraph(ctx context.Context, req *v1.GetSkillGraphRequest) (*v1.GetSkillGraphResponse, error)
GetSkillGraph gives the open view of the package's skill graph, with the tier and the area of each skill — its own area, or else the fallback area of the module's subject, as the canonical view fills it in and the open view of the graph does not: an answer without a view when the module has no graph.
func (*PackageService) GetTechniques ¶
func (s *PackageService) GetTechniques(ctx context.Context, req *v1.GetTechniquesRequest) (*v1.GetTechniquesResponse, error)
GetTechniques gives the open view of the package's technique catalog.