Documentation
¶
Overview ¶
Package catalog is api's way from a module to its package, in the contract novatrail.api.v1 (R07, R17, R18, R42): 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)
- type PackageService
- func (s *PackageService) CheckPackages(_ context.Context, req *v1.CheckPackagesRequest) (*v1.CheckPackagesResponse, 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) GetSolvingSteps(ctx context.Context, req *v1.GetSolvingStepsRequest) (*v1.GetSolvingStepsResponse, 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 (R18, R42): 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 (R72 spec).
func (*Catalog) Files ¶
Files is the handler of FilesPattern (R18, R42). 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 (R07, R42): 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 (R92 spec).
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 (R150 spec), 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.
type PackageService ¶
type PackageService struct {
// contains filtered or unexported fields
}
PackageService gives what a package gives by its digest (R62 spec, R18): the four open views, which go without a token by Connect GET and are cached for a day, and which digests the image still gives.
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) GetManifest ¶
func (s *PackageService) GetManifest(ctx context.Context, req *v1.GetManifestRequest) (*v1.GetManifestResponse, error)
GetManifest gives the open view of the package's manifest.
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 of each skill: an answer without a view when the module has no graph.
func (*PackageService) GetSolvingSteps ¶
func (s *PackageService) GetSolvingSteps(ctx context.Context, req *v1.GetSolvingStepsRequest) (*v1.GetSolvingStepsResponse, error)
GetSolvingSteps gives the open view of the package's solving steps.
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.