The entry plans
The exports of the plans service that act for the principal of the caller . The root service writes the principal of each connection, so a caller names no principal: it can see and change only its own plans.
See: Declarations: Apply, the difference and the rollback in the repository
plans module with an entry
- Hash
5cf6713b2eb4f9e3631ddec3972bcb5e0e2efaeba81d3725f9d614be9f6c3c67- Size
376832 bytes- Exports
11- Imports
0- Imported by
0- License
- MIT
The exports of the plans service that act for the principal of the caller
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/system/plans |
| Boot image | yes: in the boot image, 376832 bytes in this build |
| Build settings | none: the defaults of the source |
| Imports | none |
| Imported by | none |
Neighbours
It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.
Exports
| Export | What it does |
|---|---|
difference(rows: Table(Plan_Entry_Row, Read), summary: Table(Plan_Difference_Summary, Append)) -> Table(Plan_Diff_Row) | computes the difference between the current plan of the principal of the caller and the plan of rows, and applies nothing |
apply(plan_name: Text, rows: Table(Plan_Entry_Row, Read), expected: Plan_Expected) -> Integer | shows the difference between the plan of rows and the current plan of the principal of the caller on the trusted display, and keeps the plan until the principal decides |
apply_poll(ticket: Integer) -> Table(Plan_Generation_Row) | reads the decision of the principal on the apply of a ticket |
rollback() -> Integer | shows on the trusted display the difference between the current plan of the principal of the caller and the generation before it, and keeps the rollback until the principal decides |
rollback_poll(ticket: Integer) -> Table(Plan_Generation_Row) | reads the decision of the principal on the rollback of a ticket |
generations() -> Table(Plan_Generation_Row) | gives the applied generations of the principal of the caller, oldest first, each with where it stands against the current one |
status(out: Plans_Status) -> Integer | writes aggregate plans service counters into out |
current_generation() -> Integer | returns the active applied plan generation of the principal of the caller, or 0 when none |
diff_count() -> Integer | returns the plan differences that the service computed |
apply_generation() -> Integer | returns the newest generation that an apply committed for the principal of the caller, or 0 when none: the next apply commits the generation after it, even after a rollback |
rollback_generation() -> Integer | returns the generation that a rollback of the principal of the caller selects, and rolls nothing back |
entry() | binds the private store, the way to the trusted display and the roles page of the core, then serves the exports until stopped |
difference
difference(rows: (, Read), summary: (, Append)) -> ()
difference computes the difference between the current plan of the principal of the caller and the plan of rows, and applies nothing.
- rows: the entries of the proposed plan, 1 to 32.
- summary: one row: the counts, whether an apply needs the consent of the principal, and the hash of the current plan that apply expects.
- result: one row for each change, in the order of the difference.
The result is the count of changes, or a negative number with an error record: ERROR_NO_CALLER, ERROR_ACTS_FOR_PRINCIPAL, ERROR_NOT_READY, or ERROR_PLAN with the refusal as the value found.
rows: (, Read)summary: (, Append)
()- When it fails
- a negative result, and the error record
src/modules/system/plans/exports.odin:131
apply
apply(plan_name: , rows: (, Read), expected: ) ->
apply shows the difference between the plan of rows and the current plan of the principal of the caller on the trusted display, and keeps the plan until the principal decides. It commits nothing: apply_poll reads the decision and commits an accepted plan.
- plan_name: the name that the dialog shows, 1 to 48 bytes.
- rows: the entries of the plan, 1 to 32.
- expected: the hash of the current plan that a difference gave; zero when the principal has no applied plan. An apply whose current plan changed since is refused, so a principal never accepts a difference that it did not see.
The result is the ticket of the apply, the serial of the dialog, or a negative number with an error record: ERROR_NO_CALLER, ERROR_ACTS_FOR_PRINCIPAL, ERROR_NOT_READY, or ERROR_PLAN with the refusal as the value found: No_Change, Apply_Pending (the dialog of an earlier apply still shows), Display_Refused (the dialog cannot show the whole difference), Consent_Required (the service has no trusted display).
plan_name:rows: (, Read)expected:
- When it fails
- a negative result, and the error record
src/modules/system/plans/exports.odin:174
apply_poll
apply_poll(ticket: ) -> ()
apply_poll reads the decision of the principal on the apply of a ticket. While the dialog shows, it gives 0 and changes nothing. When the principal accepted, it writes the plan as the generation after the highest one in the private store of the service, then makes it current, and gives the generation, with its row in result. A refused difference changes nothing.
The result is 0, the new generation, or a negative number with an error record: ERROR_NO_CALLER, ERROR_ACTS_FOR_PRINCIPAL, ERROR_NOT_READY, or ERROR_PLAN with the refusal as the value found: Refused_By_Principal, No_Pending_Apply, Display_Refused, Stale_Current_Plan (another apply or a rollback came first), Store_Failed (nothing committed).
ticket:
()- When it fails
- a negative result, and the error record
src/modules/system/plans/exports.odin:216
rollback
rollback() ->
rollback shows on the trusted display the difference between the current plan of the principal of the caller and the generation before it, and keeps the rollback until the principal decides. It commits nothing and changes no role holder: a rollback restores grants and role holders, so rollback_poll commits it only when the principal accepted.
The result is the ticket of the rollback, the serial of the dialog, or a negative number with an error record: ERROR_NO_CALLER, ERROR_ACTS_FOR_PRINCIPAL, ERROR_NOT_READY, or ERROR_HISTORY with the refusal as the value found: the kind Absent and the unit Versions when no generation comes before the current one, No_Change, Apply_Pending (the dialog of an earlier apply or rollback still shows), Display_Refused, Consent_Required (the service has no trusted display), Store_Failed and Store_Damaged for the private store.
- none
- When it fails
- a negative result, and the error record
src/modules/system/plans/exports.odin:256
rollback_poll
rollback_poll(ticket: ) -> ()
rollback_poll reads the decision of the principal on the rollback of a ticket. While the dialog shows, it gives 0 and changes nothing. When the principal accepted, it makes the generation that the dialog showed the current one: the roles of principal 0 go to the root service first, then the current object of the private store is written, which is the commit. It writes no plan: the next apply still writes the generation after the highest one. A refused difference changes nothing.
The result is 0, the new current generation, or a negative number with an error record: ERROR_NO_CALLER, ERROR_ACTS_FOR_PRINCIPAL, ERROR_NOT_READY, or ERROR_HISTORY with the refusal as the value found: Refused_By_Principal, No_Pending_Apply, Display_Refused, Stale_Current_Plan (an apply or a rollback came first), Roles_Refused, Store_Failed (nothing committed).
ticket:
()- When it fails
- a negative result, and the error record
src/modules/system/plans/exports.odin:285
generations
generations() -> ()
generations gives the applied generations of the principal of the caller, oldest first, each with where it stands against the current one.
The result is the count of generations, or a negative number with an error record: ERROR_NO_CALLER, ERROR_ACTS_FOR_PRINCIPAL, ERROR_NOT_READY, or ERROR_HISTORY when the private store cannot be read.
- none
()- When it fails
- a negative result, and the error record
src/modules/system/plans/exports.odin:317
status
status(out: ) ->
status writes aggregate plans service counters into out.
out:
- When it fails
- a negative result, and the error record
src/modules/system/plans/main.odin:41
current_generation
current_generation() ->
current_generation returns the active applied plan generation of the principal of the caller, or 0 when none. A caller names no principal: it reads only its own plans (exports.odin, caller_principal).
- none
- When it fails
- a negative result, and the error record
src/modules/system/plans/main.odin:61
diff_count
diff_count() ->
diff_count returns the plan differences that the service computed.
- none
- When it fails
- a negative result, and the error record
src/modules/system/plans/main.odin:75
apply_generation
apply_generation() ->
apply_generation returns the newest generation that an apply committed for the principal of the caller, or 0 when none: the next apply commits the generation after it, even after a rollback.
- none
- When it fails
- a negative result, and the error record
src/modules/system/plans/main.odin:86
rollback_generation
rollback_generation() ->
rollback_generation returns the generation that a rollback of the principal of the caller selects, and rolls nothing back. With no earlier generation, it fails with the kind Absent and the unit Versions; found is the refusal.
- none
- When it fails
- a negative result, and the error record
src/modules/system/plans/main.odin:99
entry
entry()
entry binds the private store, the way to the trusted display and the roles page of the core, then serves the exports until stopped.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/system/plans/main.odin:114
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
| What | Value | As the root service says |
|---|---|---|
| Grants | The holder of the role Plans: the generations of the plan of each principal in its private store, the boot image and a connection to the trusted display for the difference that the principal sees, and the roles page of this service, which takes the roles of an accepted plan of principal 0 whole or refuses them whole (Root_Command.Plan_Roles; Declarations: Apply, the difference and the rollback in the repository). Its callers act for their principal; it acts for nobody. | |
| Other terms of its start grant set | callable = {0 = "display"}, on_demand = true | |
| Budget that it asks for |
| Working memory budget for the freestanding plans service process and its fixed-capacity per-principal applied_plans 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).
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).
Plan_Entry_Row record of a module
A record of the module plans: 192 bytes, aligned on 8 bytes, 0 bytes of padding.
kind_wordi6408 bytesrole_wordi6488 bytesstart_grants_maski64168 bytesstore_rights_wordi64248 bytesmodule_hashHash(32)3232 bytesinterposed_over_hashHash(32)6432 bytesrecipe_hashHash(32)9632 bytesnameText(64)12864 bytes
Plan_Difference_Summary record of a module
A record of the module plans: 168 bytes, aligned on 8 bytes, 0 bytes of padding.
change_counti6408 bytesadded_rolesi6488 bytesremoved_rolesi64168 byteschanged_rolesi64248 bytesadded_modulesi64328 bytesremoved_modulesi64408 byteschanged_modulesi64488 bytesadded_storesi64568 bytes
and 7 more
Plan_Diff_Row record of a module
A record of the module plans: 184 bytes, aligned on 8 bytes, 0 bytes of padding.
change_wordi6408 bytesentry_kind_wordi6488 bytesrole_wordi64168 bytesadded_grants_maski64248 bytesremoved_grants_maski64328 bytesold_store_rights_wordi64408 bytesnew_store_rights_wordi64488 bytesold_module_hashHash(32)5632 bytes
and 2 more
Error_Record record of a module
A record of the module plans: 56 bytes, aligned on 8 bytes, 0 bytes of padding.
kindi6408 bytesuniti6488 bytesoperationi64168 bytesargumenti64248 bytesvaluei64328 byteslimiti64408 bytesfoundi64488 bytes
Text wire form
A wire form of the module contract: one word of a call. The address of a slice record {address, count} of UTF-8 bytes.
Plan_Expected record of a module
A record of the module plans: 32 bytes, aligned on 1 bytes, 0 bytes of padding.
current_plan_hashHash(32)032 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.
Plan_Generation_Row record of a module
A record of the module plans: 88 bytes, aligned on 8 bytes, 0 bytes of padding.
generationi6408 bytestimestamp_msi6488 bytesstanding_wordi64168 bytesplan_hashHash(32)2432 bytesprevious_plan_hashHash(32)5632 bytes
Plans_Status record of a module
A record of the module plans: 32 bytes, aligned on 8 bytes, 0 bytes of padding.
total_diffsi6408 bytestotal_appliesi6488 bytestotal_rollbacksi64168 bytestotal_refusalsi64248 bytes
