modus
Menu
On this page

The entry storage

The border of a typed object and its derived migrations, bound into the storage service as internal helpers (Data evolution: stored records through a change of their type in the repository, "Where the migration runs").

No export calls them: the design keeps the storage service a store of bytes that knows no record description, and a migration runs in the process that owns the store. They bind the contract package to the one copy of the object that the border checks, so that the owner reads and migrates only bytes that no other party can change after the check.

See: Data evolution: stored records through a change of their type: The refused forms in the repository

storage module with an entry

Hash
d3b6534cb6f2c1340a5562a702721913fdd2b508df1e4f5b9a828343b0374bf0
Size
322954 bytes
Exports
28
Imports
0
Imported by
0
License
MIT

The border of a typed object and its derived migrations, bound into the storage service as internal helpers

FactValue
KindModules with an entry
Sourcesrc/modules/system/storage
Boot imageyes: in the boot image, 322954 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
freeze_tree(place: Integer, target_place: Integer) -> Texthashes the mutable tree at place bottom-up into canonical immutable tree objects stored under target_place (cloning leaf objects by hash), and writes the 32-byte domain-separated root tree hash into result
tree_read(place: Integer, hash_hex: Text) -> Textloads an immutable tree object by its 64-byte lowercase hex hash under place, validates its canonical encoding and domain-separated BLAKE3 tree hash, and writes the canonical bytes into result
tree_entry(place: Integer, hash_hex: Text, name: Text) -> Table(Tree_Entry_Row)looks up entry name inside the immutable tree hash_hex under place via binary search after full canonical and hash verification, and returns one Tree_Entry_Row
collect_garbage(place: Integer, roots: Table(Garbage_Root_Row, Read)) -> Table(Garbage_Measure)runs mark-and-sweep garbage collection over the content-addressed objects under place, keeping every hash reachable from roots (signed system modules, kept applied plans, disk grant modules, and pinned trees)
write(place: Integer, name: Text, data: Text) -> Integermakes the object name under a place the bytes of data, in one commit on the disk: a cut or an extension to the size of data, and a change of each of its blocks, as a commit of ranges does; a block that keeps its bytes keeps its block
read(place: Integer, name: Text) -> Textgives the bytes of the object name under a place: the range from 0 to its end, as read_range gives it, with the pending changes of this connection
size(place: Integer, name: Text) -> Integergives the count of bytes of the object name under a place, with the pending changes of this connection, or a negative number with an error record
remove(place: Integer, name: Text) -> Integerremoves the entry name under a place, in one commit: an object with all its versions, or a tree with all that is under it
add(place: Integer, rows: Table(Add_Row_Export, Read), names: Bytes(Read)) -> Integermakes up to 256 entries under a place in one commit, each an empty object or an empty tree: all of them, or none
open(place: Integer, name: Text) -> Integergives the place of the tree name under a place: a number for the calls of this connection only
close(place: Integer) -> Integerfrees a place of this connection
list(place: Integer, after: Text, rows: Table(Listed, Append), names: Bytes(Append)) -> Integergives a page of the entries of the tree of a place, in the order of the bytes of their names, from the first name after after (from the first entry when it is empty): as many as the rows and the names hold
rename(place: Integer, name: Text, to_place: Integer, to_name: Text) -> Integermoves the entry name under a place to the name to_name under the place to_place, in one commit: an object with its versions, or a tree with all under it
share(place: Integer, read_only: Integer) -> Table(Shared)makes a new connection to this service whose root is the tree of a place, and gives its call ring and its call region to the caller, which can give them to another process
unshare(number: Integer) -> Integerends a share that this connection made: the kernel ends its handles in each process that has them, and its places end
usage() -> Table(Usage)gives the counts of the store of the caller, in one row
stores() -> Textgives the generation of the disk, its blocks in use, and the commits, the commits that a read back refused, the commits whose root write or read back failed on the device (not taken: the next open decides), the blocks written (those of refused commits too) and the blocks read back with the time of those reads since the start of the service (a measure of the cost of the read back of each commit), then the stores that the caller may name, one line for each, with its objects, its trees, its versions, its blocks (a shared block counted one time), the blocks that two names share, its limit, the count of connections that hold its grant now, and its damage
open_store(store: Text) -> Integergives a place on the root of another store, for the exports that read it and for restore and clone: a caller that acts for principal N names the stores of principal N; another caller names its own store only; a share names no store, not even the store of its maker (may_name_store)
versions(place: Integer, name: Text) -> Table(Version)gives the states of the object name under a place, the oldest first, and its current version last: the generation, the time since the format of the disk, the date, the bytes, and the blocks that only this state holds
version(place: Integer, name: Text, generation: Integer) -> Textgives the bytes of the object name under a place at a generation: one of its versions, or its current version
restore(place: Integer, name: Text, generation: Integer) -> Integermakes a version of the object name under a place its current version again, in one commit: the current version before it becomes a version, so nothing is lost
clone(place: Integer, name: Text, new_name: Text) -> Integermakes the object new_name under a place a copy of the object name under the same place: the two name the same blocks until one of them changes
compare(place: Integer, name: Text, first: Integer, second: Integer) -> Table(Byte_Range)gives the ranges of bytes that differ between two states of the object name under a place (two generations: a version or the current version)
erase_versions(place: Integer, name: Text) -> Table(Erase_Measure)ends each version of the object name under a place, in one commit, and then writes zero bytes over each block that no other state, version or entry names after that commit: the data and the object nodes of the versions, their index and their leaves, and the tree nodes that the commit replaced
entry()The entry of the storage service: it attaches to the block service of the data disk, opens the disk, then serves the calls of its connections for the life of the machine
read_range(place: Integer, name: Text, offset: Integer) -> Textcopies the bytes of the object name under a place from offset into result, up to its end: as this connection sees it, with its pending changes
write_range(place: Integer, name: Text, offset: Integer, data: Text) -> Integerwrites the bytes of data at offset of the object name under a place, as a pending change of this connection: no commit, and no hash
set_size(place: Integer, name: Text, size: Integer) -> Integermakes the size of the object name under a place size bytes, as a pending change of this connection: a cut drops the bytes past it, an extension adds zero bytes, which hold no block
commit(place: Integer, name: Text) -> Table(Commit_Measure)puts the pending changes of this connection on the object name under a place in one commit, on the disk when the call returns

freeze_tree

freeze_tree(place: , target_place: ) -> 

freeze_tree hashes the mutable tree at place bottom-up into canonical immutable tree objects stored under target_place (cloning leaf objects by hash), and writes the 32-byte domain-separated root tree hash into result.

Error kinds

  • No_Grant (-1, -12: no store, read-only connection, or target_place is not the caller's own store);
  • Absent (-12, -7: place or target_place absent);
  • Bad_Value (-3, unit Trees: target_place is equal to or inside place);
  • Too_Long (-3, -5: tree nesting past 32 levels or more than 512 entries in one tree);
  • Over_Limit (-2: store block limit exceeded);
  • Full (-5), Device (-6), Damaged (-8).
Parameters
  • place:
  • target_place:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/immutable_trees.odin:314

tree_read

tree_read(place: , hash_hex: ) -> 

tree_read loads an immutable tree object by its 64-byte lowercase hex hash under place, validates its canonical encoding and domain-separated BLAKE3 tree hash, and writes the canonical bytes into result.

Error kinds

Parameters
  • place:
  • hash_hex:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/immutable_trees.odin:387

tree_entry

tree_entry(place: , hash_hex: , name: ) -> ()

tree_entry looks up entry name inside the immutable tree hash_hex under place via binary search after full canonical and hash verification, and returns one Tree_Entry_Row.

Error kinds

  • those of tree_read, plus Absent (-7: entry absent) and name validation errors (-3: argument 3).
Parameters
  • place:
  • hash_hex:
  • name:
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/storage/immutable_trees.odin:435

collect_garbage

collect_garbage(place: , roots: (, Read)) -> ()

collect_garbage runs mark-and-sweep garbage collection over the content-addressed objects under place, keeping every hash reachable from roots (signed system modules, kept applied plans, disk grant modules, and pinned trees). Any invalid or corrupt root or tree aborts the pass with zero deletions.

Error kinds

  • No_Grant (-1, -12: no store, read-only connection, share, or foreign store);
  • Absent (-12, -7: place absent, or a pinned tree root or child tree is absent);
  • Too_Long (-5: more than GC_ROOT_CAPACITY roots or depth bound exceeded);
  • Bad_Value (-3: unknown Root_Kind word or zero root hash);
  • Damaged (-8: corrupt root, corrupt tree, or cycle detected; zero deletions performed);
  • Full (-5: collector capacity exceeded);
  • Device (-6).
Parameters
  • place:
  • roots: (, Read)
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/storage/immutable_trees.odin:543

write

write(place: , name: , data: ) -> 

write makes the object name under a place the bytes of data, in one commit on the disk: a cut or an extension to the size of data, and a change of each of its blocks, as a commit of ranges does; a block that keeps its bytes keeps its block. A new name is a new object. The state before becomes a version. At the limit of the store, the oldest versions of the store are thinned in the same commit. The result is the generation of the commit, or a negative number with an error record.

Error kinds

  • No_Grant (-1, the caller has no store; -12, unit Changes, the connection reads only);
  • Absent (-12, unit Places: the place is not a place of this connection; -7, unit Places: its tree was removed or renamed; -7, unit Objects: the name is a tree);
  • Over_Limit (-2, the current objects with the change need more blocks than the limit, with no earlier version kept);
  • Empty, Too_Long or Bad_Byte (-3, the name has 1 to 64 bytes, no zero byte, no byte '/', and is not "." or "..");
  • Too_Long (-4, the data has more bytes than the call region holds: write a larger object by ranges);
  • Full (-5, no place for one more store, or no free block; with the unit Commit_Blocks, the commit changes more blocks than one commit can);
  • Device (-6; unit Dropped_Writes: the read back after the commit found blocks with other bytes, found their count: the disk did not keep the commit, and the object keeps its state before);
  • Damaged (-8, unit Stores: a node of a tree of the store has a wrong check; unit Counts: the counts of the store are not trusted after a fault of the service).
Parameters
  • place:
  • name:
  • data:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:359

read

read(place: , name: ) -> 

read gives the bytes of the object name under a place: the range from 0 to its end, as read_range gives it, with the pending changes of this connection. The result is the count of bytes; the size when they do not fit in the result; or a negative number with an error record.

Error kinds

  • No_Grant (-1);
  • Absent (-12, -7: the place; -7: the tree has no such object);
  • Empty, Too_Long or Bad_Byte (-3, the name);
  • Device (-6);
  • Damaged (-8: a block of the object or a node of a tree of the store has a wrong check: the service does not give its bytes).
Parameters
  • place:
  • name:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:377

size

size(place: , name: ) -> 

size gives the count of bytes of the object name under a place, with the pending changes of this connection, or a negative number with an error record.

Error kinds

  • those of read, but Device and Damaged for a block of the object: size reads the tree only.
Parameters
  • place:
  • name:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:395

remove

remove(place: , name: ) -> 

remove removes the entry name under a place, in one commit: an object with all its versions, or a tree with all that is under it. The name is gone at the commit; the blocks of a tree are freed after it, in steps of 64 entries, one commit each, while no call waits (usage gives the trees that wait). The result is the generation of the commit, or a negative number with an error record.

Error kinds

  • those of write, and Absent (-7, the tree has no entry with this name).
Parameters
  • place:
  • name:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:409

add

add(place: , rows: (, Read), names: (Read)) -> 

add makes up to 256 entries under a place in one commit, each an empty object or an empty tree: all of them, or none. The names are bytes of the argument names, each named by a row. The result is the generation of the commit, or a negative number with an error record.

Error kinds

  • those of write;
  • Too_Long (-5, more than 256 rows);
  • Bad_Value (-3, a kind that is not 1 or 2);
  • Out_Of_Range (-3, a row names bytes past the names);
  • Exists (-11, a name exists, or two rows have one name: found is the row).
Parameters
  • place:
  • rows: (, Read)
  • names: (Read)
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:435

open

open(place: , name: ) -> 

open gives the place of the tree name under a place: a number for the calls of this connection only. The tree and what is under it are what the place reaches; no name under it reaches above it.

Error kinds

  • No_Grant (-1);
  • Absent (-12, -7: the place; -7, unit Trees: no tree has this name);
  • the errors of a name (-3);
  • Too_Long (-3, unit Trees: the place would be more than 32 trees deep);
  • Full (-5, unit Places: no free place);
  • Damaged (-8);
  • Device (-6).
Parameters
  • place:
  • name:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:464

close

close(place: ) -> 

close frees a place of this connection. The result is 0, or a negative number with an error record.

Error kinds

Parameters
  • place:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:501

list

list(place: , after: , rows: (, Append), names: (Append)) -> 

list gives a page of the entries of the tree of a place, in the order of the bytes of their names, from the first name after after (from the first entry when it is empty): as many as the rows and the names hold. A tree of any size is read in pages; the next page starts after the last name of this one. The result is the count of the rows of the page (0: no more entries), or a negative number with an error record.

Error kinds

Parameters
  • place:
  • after:
  • rows: (, Append)
  • names: (Append)
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:534

rename

rename(place: , name: , to_place: , to_name: ) -> 

rename moves the entry name under a place to the name to_name under the place to_place, in one commit: an object with its versions, or a tree with all under it. Both places are of this connection, so of one store. The result is the generation of the commit, or a negative number with an error record.

Error kinds

  • those of write;
  • Absent (-7, no entry name);
  • Exists (-11, to_name exists);
  • Bad_Value (-3, unit Trees: to_place is inside the tree that moves).
Parameters
  • place:
  • name:
  • to_place:
  • to_name:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:602

share

share(place: , read_only: ) -> ()

share makes a new connection to this service whose root is the tree of a place, and gives its call ring and its call region to the caller, which can give them to another process. With read_only 1 the connection changes nothing. A connection that reads only makes shares that read only. The share ends when the caller calls unshare, or when the connection that made it loses its store. The result is one row, or a negative number with an error record.

Error kinds

  • No_Grant (-1);
  • Absent (-12, -7: the place);
  • Full (-5, unit Connections: no free share);
  • Refused (-6: the kernel refused a memory object or a give).
Parameters
  • place:
  • read_only:
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:637

unshare

unshare(number: ) -> 

unshare ends a share that this connection made: the kernel ends its handles in each process that has them, and its places end. The result is 0, or a negative number with an error record.

Error kinds

  • Absent (-12, unit Connections: no share of this connection has this number).
Parameters
  • number:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:724

usage

usage() -> ()

usage gives the counts of the store of the caller, in one row. Through a share of a tree, it gives the counts of that tree only: the objects, the trees and the versions under it, and its blocks (the nodes of its trees, the blocks of the current state of each object, the index and the leaves of their versions), with the limit of the store and no removal; a tree that needs more reads to count than SHARE_USAGE_READ_LIMIT, or that has a wrong block, gives USAGE_NOT_COUNTED in objects, trees, versions and blocks. A share never sees a count of the whole store: it would tell the holder what the rest of the store holds.

Parameters
none
Result
()
Source
src/modules/system/storage/main.odin:753

stores

stores() -> 

stores gives the generation of the disk, its blocks in use, and the commits, the commits that a read back refused, the commits whose root write or read back failed on the device (not taken: the next open decides), the blocks written (those of refused commits too) and the blocks read back with the time of those reads since the start of the service (a measure of the cost of the read back of each commit), then the stores that the caller may name, one line for each, with its objects, its trees, its versions, its blocks (a shared block counted one time), the blocks that two names share, its limit, the count of connections that hold its grant now, and its damage. Only a caller that acts for a principal sees them: the stores of that principal. The result is the count of bytes of the text, or a negative number with an error record.

Error kinds

  • No_Grant (-10, unit Acts_For_Principal: the caller does not act for a principal);
  • Device (-6: the disk went silent before the open, and the service knows no store).
Parameters
none
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:793

open_store

open_store(store: ) -> 

open_store gives a place on the root of another store, for the exports that read it and for restore and clone: a caller that acts for principal N names the stores of principal N; another caller names its own store only; a share names no store, not even the store of its maker (may_name_store). write, add, remove, rename and share refuse a place of another store. The result is the place, or a negative number with an error record.

Error kinds

  • No_Grant (-10, unit Acts_For_Principal: the caller may not name this store);
  • Absent (-7, unit Stores: no such store);
  • Full (-5, unit Places: no free place).
Parameters
  • store:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:852

versions

versions(place: , name: ) -> ()

versions gives the states of the object name under a place, the oldest first, and its current version last: the generation, the time since the format of the disk, the date, the bytes, and the blocks that only this state holds. The place can be a place of another store (open_store). The result is the count of the rows, or a negative number with an error record.

Error kinds

Parameters
  • place:
  • name:
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:906

version

version(place: , name: , generation: ) -> 

version gives the bytes of the object name under a place at a generation: one of its versions, or its current version. The place: as for versions. The result is the count of bytes, or a negative number with an error record.

Error kinds

  • those of versions;
  • Absent (-9, the object has no version of this generation);
  • Damaged (-8, a block of this version has a wrong check).
Parameters
  • place:
  • name:
  • generation:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:936

restore

restore(place: , name: , generation: ) -> 

restore makes a version of the object name under a place its current version again, in one commit: the current version before it becomes a version, so nothing is lost. No block of data is written: the object names the blocks of the version. The place: as for versions. The result is the generation of the commit, or a negative number with an error record.

Error kinds

  • those of version, and those of write.
Parameters
  • place:
  • name:
  • generation:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:961

clone

clone(place: , name: , new_name: ) -> 

clone makes the object new_name under a place a copy of the object name under the same place: the two name the same blocks until one of them changes. A state of new_name before becomes a version. The place: as for versions. The result is the generation of the commit, or a negative number with an error record.

Error kinds

  • those of restore;
  • new_name is argument 3.
Parameters
  • place:
  • name:
  • new_name:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:992

compare

compare(place: , name: , first: , second: ) -> ()

compare gives the ranges of bytes that differ between two states of the object name under a place (two generations: a version or the current version). Two blocks that the two states both name are equal bytes and are not read. The place: as for versions. The result is the count of the ranges, or a negative number with an error record.

Error kinds

  • those of version;
  • first and second are arguments 3 and 4.
Parameters
  • place:
  • name:
  • first:
  • second:
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:1021

erase_versions

erase_versions(place: , name: ) -> ()

erase_versions ends each version of the object name under a place, in one commit, and then writes zero bytes over each block that no other state, version or entry names after that commit: the data and the object nodes of the versions, their index and their leaves, and the tree nodes that the commit replaced. The current version stays, with its generation. A block that another state still names keeps its bytes, and the row counts it. Before the zeros, the commit reads back its blocks and its root, past the cache of the service, then the service writes the root of the commit again with the next generation and reads it back, so that no root on the disk names a block of zeros; after the zeros it reads them back. A loss of power leaves the versions or none of them. The disk device can keep old copies of a block that the service does not see. Only a process with the grant Versions_Erase may call it, on its own store: a process without it, a share, a place of another store and a connection that reads only are refused. An object with no version makes no commit. The result is one row: the generation of the last root, the versions ended, the blocks written with zeros, the blocks kept because another state names them, and the damaged parts of the versions that were ended without zeros; or a negative number with an error record.

Error kinds

  • No_Grant (-1, the caller has no store, or the place is of another store; -12, unit Changes: a share, or a connection that reads only; -12, unit Versions_Erase: the caller has no grant Versions_Erase);
  • Absent (-12, unit Places: the place is not a place of this connection; -7, unit Places: its tree was removed or renamed; -7, unit Objects: no such object, or the name is a tree);
  • Empty, Too_Long or Bad_Byte (-3, the name);
  • Full (-5, unit Commit_Blocks: the versions free more blocks than one commit can);
  • Device (-6: unit Dropped_Writes, the read back of the commit of the end found blocks with other bytes, and the versions stay; with no unit, a write or a read failed, or the read back of the second root found other bytes, and after the commit of the end the versions are gone and some blocks can hold their old bytes; the log says which). The row counts as zeroed only the blocks that read back as zeros; a block that the disk did not write with zeros keeps its old bytes, and the log says it;
  • Damaged (-8, unit Stores or Counts, as for write).

See: The erase of the versions of an object in the repository

Parameters
  • place:
  • name:
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/storage/main.odin:1131

entry

entry()

The entry of the storage service: it attaches to the block service of the data disk, opens the disk, then serves the calls of its connections for the life of the machine.

The root service starts it on demand: at the first connection to storage, or before the first process with a private store. The entry, in order:

  1. 1. opens its service ring and the block ring; with no service ring, it writes "storage: no service ring" and stops with Refused, as with no seed in its context; with no block ring, it writes "storage: no block ring" and stops with Failed;
  2. 2. creates the data region, one contiguous memory object that the device reads and writes, and gives it to the block service with the command Attach; a refusal stops it with Failed;
  3. 3. opens the disk (mount): it reads the two roots, takes the newest one with a good check, and checks each block that a store names.

The open ends in one of three ways:

  • no valid root: "storage: no valid root on the disk"; the service keeps the disk as it is, serves nothing, and stops with Failed;
  • a new disk: it formats the disk and writes "storage: ok, a new disk: generation 1, N blocks";
  • a disk with data: "storage: ok, generation G: S stores, O objects, ...", with one warning line for each kind of damage that it found. A damaged object gives Damaged to a read; the other objects are served.

Then one loop runs for ever. It waits on the service ring and on each share, and runs the calls that wait. When no call waits, it frees one step of a tree that a removal left: a large removal never makes a caller wait.

A disk that stops to answer. Each wait for the block service ends when that service stops, or after system.ANSWER_BOUND_MILLISECONDS with no completion; a completion with the record No_Answer of the device ends it too. The disk is then silent: the service writes "storage: the disk does not answer: <the cause>; the service reads and changes nothing on the disk until its next start, and refuses each call that needs the disk", sends no request to the block service again, and answers each call that needs a block with Device. A disk that goes silent before the open is done leaves the service running with no store known: it answers each call that names a store with Device, and usage gives no count. It does not stop: the root service would start it again, with a new block service and a reset of a device that still holds a request.

See: A missing or silent part of the machine in the repository

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

read_range

read_range(place: , name: , offset: ) -> 

read_range copies the bytes of the object name under a place from offset into result, up to its end: as this connection sees it, with its pending changes. A hole reads as zero bytes. The result is the count of bytes (0 at the end), or a negative number with an error record.

The error kinds: those of read; Out_Of_Range (-3, offset is past the end: limit the size).

Parameters
  • place:
  • name:
  • offset:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/ranges.odin:318

write_range

write_range(place: , name: , offset: , data: ) -> 

write_range writes the bytes of data at offset of the object name under a place, as a pending change of this connection: no commit, and no hash. A read of this connection sees it at once; another connection sees the object as its last commit gives it. The object grows when the range passes its end; a new name is a new object at the commit. A loss of power before commit loses the pending changes. The result is the size of the object with the pending changes, or a negative number with an error record.

The error kinds: No_Grant (-1; -12, unit Changes: the connection reads only); Absent (-12, -7: the place; -7, unit Objects: the name is a tree); the errors of a name (-3); Bad_Value (-3: offset is negative); Too_Long (-4: the object would pass 4 TiB); Full (-5, unit Pending: the service holds no more pending blocks or objects: commit first); Damaged (-8: a block that the range changes in part has a wrong check); Device (-6).

Parameters
  • place:
  • name:
  • offset:
  • data:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/ranges.odin:334

set_size

set_size(place: , name: , size: ) -> 

set_size makes the size of the object name under a place size bytes, as a pending change of this connection: a cut drops the bytes past it, an extension adds zero bytes, which hold no block. The result is the size, or a negative number with an error record.

The error kinds: those of write_range.

Parameters
  • place:
  • name:
  • size:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/storage/ranges.odin:371

commit

commit(place: , name: ) -> ()

commit puts the pending changes of this connection on the object name under a place in one commit, on the disk when the call returns. The state before becomes a version. The commit hashes the blocks that changed and the object nodes above them, and the path of the last block: never the whole object. The result is one row: the generation, and the measure of the commit (the blocks of the object, the blocks changed, hashed and written); or a negative number with an error record.

The error kinds: those of write; Absent (-13, unit Pending: the object has no pending change on this connection; found 1: another change of the object came first since the first pending change, and the pending changes are dropped); Damaged (-8: the state before is damaged; the pending changes are dropped).

Parameters
  • place:
  • name:
Result
()
When it fails
a negative result, and the error record
Source
src/modules/system/storage/ranges.odin:416

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
GrantsIt is the one client of the block service of the data disk, and it serves a private store to each caller with the grant Store. It starts at the first connection to it.
Other terms of its start grant seton_demand = true
Budget that it asks for
  • working memory pages 1829
  • 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
Its tables, about 44 MB, are data of its module, so the tool counts them with the module: the count of names of each block of the disk, the hash index of the roots of the current objects (10 MB), the changes of one commit (8 MB: each block of the disk), the leaves of one version index, the versions of one object for versions(), the nodes of the trees of one commit and of one read, the walks of the trees, the pending blocks of the ranges (4 MB), and the object nodes that one commit copies (7 MB). The working memory: the regions of its connections, and the rest of the 10240 pages that it had before the tool counted.

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

Integer wire form

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

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.

Error_Record record of a module

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

  • kindi6408 bytes
  • uniti6488 bytes
  • operationi64168 bytes
  • argumenti64248 bytes
  • valuei64328 bytes
  • limiti64408 bytes
  • foundi64488 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).

Tree_Entry_Row record of a module

A record of the module storage: 40 bytes, aligned on 8 bytes, 0 bytes of padding.

  • kindi6408 bytes
  • hashHash(32)832 bytes

Garbage_Root_Row record of a module

A record of the module storage: 40 bytes, aligned on 8 bytes, 0 bytes of padding.

  • kindi6408 bytes
  • hashHash(32)832 bytes

Garbage_Measure record of a module

A record of the module storage: 24 bytes, aligned on 8 bytes, 0 bytes of padding.

  • markedi6408 bytes
  • swepti6488 bytes
  • trees_traversedi64168 bytes

Add_Row_Export record of a module

A record of the module storage: 24 bytes, aligned on 8 bytes, 0 bytes of padding.

  • name_offseti6408 bytes
  • name_counti6488 bytes
  • kindi64168 bytes

Bytes wire form

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

Listed record of a module

A record of the module storage: 40 bytes, aligned on 8 bytes, 0 bytes of padding.

  • name_offseti6408 bytes
  • name_counti6488 bytes
  • kindi64168 bytes
  • sizei64248 bytes
  • generationi64328 bytes

Shared record of a module

A record of the module storage: 24 bytes, aligned on 8 bytes, 0 bytes of padding.

  • sharei6408 bytes
  • ringi6488 bytes
  • regioni64168 bytes

Usage record of a module

A record of the module storage: 48 bytes, aligned on 8 bytes, 0 bytes of padding.

  • objectsi6408 bytes
  • treesi6488 bytes
  • versionsi64168 bytes
  • blocksi64248 bytes
  • limiti64328 bytes
  • removingi64408 bytes

Version record of a module

A record of the module storage: 48 bytes, aligned on 8 bytes, 0 bytes of padding.

  • generationi6408 bytes
  • timei6488 bytes
  • datei64168 bytes
  • bytesi64248 bytes
  • own_blocksi64328 bytes
  • currenti64408 bytes

Byte_Range record of a module

A record of the module storage: 16 bytes, aligned on 8 bytes, 0 bytes of padding.

  • firsti6408 bytes
  • counti6488 bytes

Erase_Measure record of a module

A record of the module storage: 40 bytes, aligned on 8 bytes, 0 bytes of padding.

  • generationi6408 bytes
  • versionsi6488 bytes
  • zeroedi64168 bytes
  • kepti64248 bytes
  • damagedi64328 bytes

Commit_Measure record of a module

A record of the module storage: 72 bytes, aligned on 8 bytes, 0 bytes of padding.

  • generationi6408 bytes
  • object_blocksi6488 bytes
  • held_blocksi64168 bytes
  • changedi64248 bytes
  • hashed_blocksi64328 bytes
  • hashed_nodesi64408 bytes
  • object_writteni64488 bytes
  • writteni64568 bytes

and 1 more

target_place global variable of the package edit

target_place: storage.Place = storage.ROOT

A global variable with no comment in its source.

src/modules/system/edit/main.odin:209

ANSWER_BOUND_MILLISECONDS constant of the package system

ANSWER_BOUND_MILLISECONDS :: TEST_HANG_BOUND_MILLISECONDS

The bound of a wait for an answer.

src/library/modus/system/answer_wait.odin:15