modus
Menu
On this page

The entry recipes

recipes module with an entry

Hash
32dee536829fcce84cc56cb8f8ac3c3658c97b0e4da8c0013a3d30b4f5c5a877
Size
143360 bytes
Exports
9
Imports
0
Imported by
0
License
MIT

The exports of the recipes service

FactValue
KindModules with an entry
Sourcesrc/modules/system/recipes
Boot imageyes: in the boot image, 143360 bytes in this build
Build settingsnone: the defaults of the source
Importsnone
Imported bynone

Neighbours

It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.

Exports

ExportWhat it does
register(head: Recipe_Head, inputs: Table(Recipe_Input_Row, Read), arguments: Bytes(Read)) -> Table(Recipe_Reference)keeps a recipe by its hash, so build and cache_lookup name it with 32 bytes
register_evaluation(output: Bytes(Read)) -> Table(Recipe_Reference)keeps the recipe that a declaration names, from the output of its evaluation: outputs.default of a project, as the evaluator wrote it
build(recipe: Recipe_Reference, mode: Integer) -> Table(Recipe_Build_Row)realises a registered recipe
cache_lookup(recipe: Recipe_Reference) -> Table(Realisation_Row)gives the realisation of a recipe in the local store, with no build
builds() -> Table(Recipe_Build_Row)gives the newest builds, oldest first, at most 32
realisations() -> Table(Realisation_Row)gives each realisation of the local store
status(out: Recipes_Status) -> Integerwrites aggregate recipes service counters into out
build_count() -> Integerreturns the build requests whose mode and recipe the service accepted, whatever their outcome
cache_hits() -> Integerreturns the builds that a cached realisation answered, from the local store or from a remote cache, with no build in the sandbox
entry()initializes the delegated recipes service ring and loops over build and provenance commands until stopped

register

register(head: , inputs: (, Read), arguments: (Read)) -> ()

register keeps a recipe by its hash, so build and cache_lookup name it with 32 bytes.

  • head: the builder hash, the output kind, the date of the recipe and the bound of its output in blocks.
  • inputs: one row for each input, a name and a hash, at most 32.
  • arguments: the bytes of the argument record, at most 4096.
  • result: one row: the recipe hash.

The result is 1, or a negative number with an error record: ERROR_NO_CALLER, ERROR_ACTS_FOR_PRINCIPAL, ERROR_NOT_READY, or ERROR_RECIPE with the refusal as the value found.

Parameters
  • head:
  • inputs: (, Read)
  • arguments: (Read)
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/recipes/exports.odin:75

register_evaluation

register_evaluation(output: (Read)) -> ()

register_evaluation keeps the recipe that a declaration names, from the output of its evaluation: outputs.default of a project, as the evaluator wrote it. The service copies the bytes into its own memory before it reads them, converts them with the one conversion of the contract, and registers the record under the hash that the evaluator wrote.

  • output: the output of the evaluation, whose value is a recipe.
  • result: one row: the recipe hash.

The result is 1, or a negative number with an error record: ERROR_NO_CALLER, ERROR_ACTS_FOR_PRINCIPAL, ERROR_NOT_READY, or ERROR_RECIPE with the refusal as the value found: a bare hash, an input below the first level, a value that is no recipe, a damaged output, too many inputs, arguments too large.

See: Applications as projects: The export of the service in the repository

Parameters
  • output: (Read)
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/recipes/exports.odin:137

build

build(recipe: , mode: ) -> ()

build realises a registered recipe. A mode that takes the cache gives a realisation of the local store at once, with no build; on a miss the service builds the recipe, keeps its output and its realisation, and the next build of the recipe is a hit.

  • recipe: the recipe hash that register gave.
  • mode: the Build_Mode word: 1 Cache_First, 2 Build_Only, 3 Cache_Only, 4 Verify.
  • result: one row: the outcome, the recipe hash and the output hash.

The result is 1, or a negative number with an error record: ERROR_NO_CALLER, ERROR_ACTS_FOR_PRINCIPAL, ERROR_NOT_READY, or ERROR_BUILD with the refusal as the value found.

Parameters
  • recipe:
  • mode:
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/recipes/exports.odin:177

cache_lookup

cache_lookup(recipe: ) -> ()

cache_lookup gives the realisation of a recipe in the local store, with no build.

  • recipe: the recipe hash.
  • result: one row when the store holds a realisation of the recipe.

The result is 1 when the store holds one, 0 when it holds none, or a negative number with an error record: ERROR_NO_CALLER or ERROR_NOT_READY.

Parameters
  • recipe:
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/recipes/exports.odin:212

builds

builds() -> ()

builds gives the newest builds, oldest first, at most 32.

The result is the count of builds, or a negative number with an error record: ERROR_NO_CALLER or ERROR_NOT_READY.

Parameters
none
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/recipes/exports.odin:235

realisations

realisations() -> ()

realisations gives each realisation of the local store.

The result is the count of realisations, or a negative number with an error record: ERROR_NO_CALLER or ERROR_NOT_READY.

Parameters
none
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/recipes/exports.odin:247

status

status(out: ) -> 

status writes aggregate recipes service counters into out.

Parameters
  • out:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/recipes/main.odin:61

build_count

build_count() -> 

build_count returns the build requests whose mode and recipe the service accepted, whatever their outcome. A request refused for its mode or for its recipe does not count: status() counts it as a refusal.

Parameters
none
Result
When it fails
a negative result, and the error record
Source
src/modules/system/recipes/main.odin:84

cache_hits

cache_hits() -> 

cache_hits returns the builds that a cached realisation answered, from the local store or from a remote cache, with no build in the sandbox.

Parameters
none
Result
When it fails
a negative result, and the error record
Source
src/modules/system/recipes/main.odin:94

entry

entry()

entry initializes the delegated recipes service ring and loops over build and provenance commands until stopped.

Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/system/recipes/main.odin:232

Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).

What the root service gives it

WhatValueAs the root service says
GrantsThe holder of the role Recipes: the cache of the realisations and the recipes in its private store. See: Recipes, builders and the cache in the repository
Other terms of its start grant seton_demand = true
Budget that it asks for
  • working memory pages 1024
  • pages of its threads 72
  • pages of the pictures of its window 0
  • pages of the module and its imports from the files of the build
  • processes 1
  • threads 1
Working memory budget for the freestanding recipes service process, including local object staging and realisation tables.

The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).

Recipe_Head record of a module

A record of the module recipes: 56 bytes, aligned on 8 bytes, 0 bytes of padding.

  • output_kind_wordi6408 bytes
  • source_date_unixi6488 bytes
  • output_block_limiti64168 bytes
  • builder_hashHash(32)2432 bytes

Table wire form

A wire form of the module contract: one word of a call. Records of one description that follow each other (a table).

Recipe_Input_Row record of a module

A record of the module recipes: 104 bytes, aligned on 8 bytes, 0 bytes of padding.

  • kind_wordi6408 bytes
  • hashHash(32)832 bytes
  • nameText(64)4064 bytes

Bytes wire form

A wire form of the module contract: one word of a call. Bytes with no description.

Recipe_Reference record of a module

A record of the module recipes: 32 bytes, aligned on 1 bytes, 0 bytes of padding.

  • recipe_hashHash(32)032 bytes

Error_Record record of a module

A record of the module recipes: 56 bytes, aligned on 8 bytes, 0 bytes of padding.

  • kindi6408 bytes
  • uniti6488 bytes
  • operationi64168 bytes
  • argumenti64248 bytes
  • valuei64328 bytes
  • limiti64408 bytes
  • foundi64488 bytes

Integer wire form

A wire form of the module contract: one word of a call. A signed integer of 64 bits, in a register.

Recipe_Build_Row record of a module

A record of the module recipes: 96 bytes, aligned on 8 bytes, 0 bytes of padding.

  • outcome_wordi6408 bytes
  • refusal_wordi6488 bytes
  • output_kind_wordi64168 bytes
  • mode_wordi64248 bytes
  • recipe_hashHash(32)3232 bytes
  • output_hashHash(32)6432 bytes

Realisation_Row record of a module

A record of the module recipes: 112 bytes, aligned on 8 bytes, 0 bytes of padding.

  • origin_wordi6408 bytes
  • output_kind_wordi6488 bytes
  • recipe_hashHash(32)1632 bytes
  • output_hashHash(32)4832 bytes
  • signer_public_keyHash(32)8032 bytes

Recipes_Status record of a module

A record of the module recipes: 56 bytes, aligned on 8 bytes, 0 bytes of padding.

  • total_buildsi6408 bytes
  • cache_hits_locali6488 bytes
  • cache_hits_remotei64168 bytes
  • local_buildsi64248 bytes
  • verify_agreementsi64328 bytes
  • verify_disagreementsi64408 bytes
  • total_refusalsi64488 bytes