The entry collector
Delegated collector and wide-grant audit service .
Maintains the per-principal append-only BLAKE3 hash-chained act record store and enforces wide-grant proofs, window bounds, monotonic expiry, instant revocation, sensitive-action blocks, and fail-closed recording.
See: Record outputs and record inputs of a module: typed streams of records between processes in the repository, Grants of wide authority, for agents first in the repository
collector module with an entry
- Hash
5200a5548191a48fd6595c7136e3869090b134abf650b7e21bb76d77b46c9011- Size
299008 bytes- Exports
13- Imports
0- Imported by
0- License
- MIT
Delegated collector and wide-grant audit service
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/system/collector |
| Boot image | yes: in the boot image, 299008 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 |
|---|---|
act_record_count() -> Integer | returns the number of hash-chained act records of wide grants stored in the collector |
active_grant_count() -> Integer | returns the number of currently active wide grants |
status(out: Collector_Status) -> Integer | writes aggregate collector and wide-grant counters into out |
verify_chain(out: Chain_Verification_Report) -> Integer | walks the full hash-chained act store and reports integrity |
act_records_read(grant: Integer, first: Integer, last: Integer, result: Table(Act_Record, Append)) -> Integer | gives the act records of the wide grants that this collector keeps, oldest first: those of grant (0 for each grant) whose sequence is in first ..= last |
entry() | initializes the freestanding collector service ring, data region, and wide-grant manager, then loops over commands and monotonic expiry checks |
space_open(source: Text, output: Text, terms: Space_Terms) -> Integer | gives the space of a source and one of its record outputs, with its terms |
record_append(space: Integer, record: Bytes(Read)) -> Integer | keeps one record in a space, and queues it for the forward when the space forwards: the space keeps the record before the queue takes it |
records_read(space: Integer, after: Integer, limit: Integer, heads: Table(Kept_Record_Head, Append), bytes: Bytes(Append)) -> Integer | gives the records of a space whose serial is after after (-1 for each record), oldest first, at most limit of them: a head for each, and their bytes one after the other |
spaces() -> Table(Space_Row) | gives the state of each space, except the spaces whose source is the caller |
space_stats(space: Integer, out: Space_Row) -> Integer | gives the state of one space: its terms, its counts and its last link |
space_verify(space: Integer) -> Integer | walks the chain of an audit space in memory, then reads each of its segments back from the private store and compares it |
source_count() -> Integer | gives the sources that have a space |
record_count() -> Integer | gives the records that the spaces keep now |
act_record_count
act_record_count() ->
act_record_count returns the number of hash-chained act records of wide grants stored in the collector.
- none
- When it fails
- a negative result, and the error record
src/modules/system/collector/main.odin:75
active_grant_count
active_grant_count() ->
active_grant_count returns the number of currently active wide grants.
- none
- When it fails
- a negative result, and the error record
src/modules/system/collector/main.odin:87
status
status(out: ) ->
status writes aggregate collector and wide-grant counters into out.
out:
- When it fails
- a negative result, and the error record
src/modules/system/collector/main.odin:99
verify_chain
verify_chain(out: ) ->
verify_chain walks the full hash-chained act store and reports integrity.
out:
- When it fails
- a negative result, and the error record
src/modules/system/collector/main.odin:124
act_records_read
act_records_read(grant: , first: , last: , result: (, Append)) ->
act_records_read gives the act records of the wide grants that this collector keeps, oldest first: those of grant (0 for each grant) whose sequence is in first ..= last. A table holds at most QUERY_STAGING_CAPACITY records of one call; a reader that wants more asks again after the last sequence that it received.
The result is the count of such records, or a negative number with an error record: ERROR_NO_CALLER, ERROR_NOT_PRINCIPAL, or ERROR_SPACE.
grant:first:last:result: (, Append)
- When it fails
- a negative result, and the error record
src/modules/system/collector/main.odin:200
entry
entry()
entry initializes the freestanding collector service ring, data region, and wide-grant manager, then loops over commands and monotonic expiry checks.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/system/collector/main.odin:495
space_open
space_open(source: , output: , terms: ) ->
space_open gives the space of a source and one of its record outputs, with its terms. A pair with a space of the same record and terms gives that space again. A source never opens a space of its own: the terms of an audit are the choice of its starter.
- source: the name of the source process.
- output: the name of its record output, or log.
- terms: Keep or Audit, the bound in records, whether the space forwards, and the size of the record.
The result is the number of the space, from 1, or a negative number with an error record: ERROR_NO_CALLER, ERROR_NOT_PRINCIPAL, or ERROR_SPACE with the refusal as the value found.
source:output:terms:
- When it fails
- a negative result, and the error record
src/modules/system/collector/spaces.odin:165
record_append
record_append(space: , record: (Read)) ->
record_append keeps one record in a space, and queues it for the forward when the space forwards: the space keeps the record before the queue takes it. A full audit space or a full forward queue refuses the record and keeps nothing: its writer waits and sends it again, so no record is lost.
A record of an audit space is written into its segment in the private store first: a refused write keeps nothing and forwards nothing.
The result is the serial of the record in its space, or a negative number with an error record: ERROR_NO_CALLER, ERROR_NOT_PRINCIPAL, ERROR_FULL, ERROR_STORE, or ERROR_SPACE with the refusal as the value found.
space:record: (Read)
- When it fails
- a negative result, and the error record
src/modules/system/collector/spaces.odin:206
records_read
records_read(space: , after: , limit: , heads: (, Append), bytes: (Append)) ->
records_read gives the records of a space whose serial is after after (-1 for each record), oldest first, at most limit of them: a head for each, and their bytes one after the other. A source never reads its own space. A reader that wants more asks again after the last serial that it received.
The result is the count of such records, or a negative number with an error record: ERROR_NO_CALLER, ERROR_NOT_PRINCIPAL, or ERROR_SPACE.
space:after:limit:heads: (, Append)bytes: (Append)
- When it fails
- a negative result, and the error record
src/modules/system/collector/spaces.odin:269
spaces
spaces() -> ()
spaces gives the state of each space, except the spaces whose source is the caller.
The result is the count of such spaces, or a negative number with an error record: ERROR_NO_CALLER or ERROR_NOT_PRINCIPAL.
- none
()- When it fails
- a negative result, and the error record
src/modules/system/collector/spaces.odin:294
space_stats
space_stats(space: , out: ) ->
space_stats gives the state of one space: its terms, its counts and its last link. A source never reads the state of its own space.
The result is 0, or a negative number with an error record: ERROR_NO_CALLER, ERROR_NOT_PRINCIPAL, or ERROR_SPACE.
space:out:
- When it fails
- a negative result, and the error record
src/modules/system/collector/spaces.odin:323
space_verify
space_verify(space: ) ->
space_verify walks the chain of an audit space in memory, then reads each of its segments back from the private store and compares it.
The result is 0, or a negative number with an error record: ERROR_NO_CALLER, ERROR_NOT_PRINCIPAL, ERROR_STORE, or ERROR_SPACE with Chain_Broken as the value found and the serial of the first broken link, or the first serial of the first segment that does not match, as the value.
space:
- When it fails
- a negative result, and the error record
src/modules/system/collector/spaces.odin:354
source_count
source_count() ->
source_count gives the sources that have a space.
- none
- When it fails
- a negative result, and the error record
src/modules/system/collector/spaces.odin:370
record_count
record_count() ->
record_count gives the records that the spaces keep now.
- none
- When it fails
- a negative result, and the error record
src/modules/system/collector/spaces.odin:386
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 collector of principal 0: the audit spaces of the record outputs that a wiring gives it, as segments chained by their hash in its private store, and the act records of the wide grants . Its callers act for its principal; it acts for nobody. A source reaches it only through a wiring, never through a grant. See: Record outputs and record inputs of a module: typed streams of records between processes: The collector in the repository | |
| Other terms of its start grant set | on_demand = true | |
| Budget that it asks for |
| Working memory budget for the freestanding collector and wide-grant audit service. |
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.
Error_Record record of a module
A record of the module collector: 56 bytes, aligned on 8 bytes, 0 bytes of padding.
kindi6408 bytesuniti6488 bytesoperationi64168 bytesargumenti64248 bytesvaluei64328 byteslimiti64408 bytesfoundi64488 bytes
Collector_Status record of a module
A record of the module collector: 64 bytes, aligned on 8 bytes, 0 bytes of padding.
active_grantsi6408 bytestotal_grants_createdi6488 bytestotal_grants_revokedi64168 bytestotal_grants_expiredi64248 bytestotal_acts_permittedi64328 bytestotal_acts_blockedi64408 bytesrecorded_actsi64488 bytesrefused_full_counti64568 bytes
Chain_Verification_Report record of a module
A record of the module collector: 32 bytes, aligned on 8 bytes, 0 bytes of padding.
refusal_codei6408 bytesfailing_indexi6488 bytesrecord_counti64168 bytesverify_callsi64248 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).
Act_Record record of a module
A record of the module collector: 120 bytes, aligned on 8 bytes, 0 bytes of padding.
sequence_numberu6408 bytesgrant_serialu6488 bytestimestamp_msu64168 bytesact_kind_wordu64248 bytestarget_window_idu64328 bytesdetail_word_0u64408 bytesdetail_word_1u64488 bytesprevious_hashText(32)5632 bytes
and 1 more
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.
Space_Terms record of a module
A record of the module collector: 32 bytes, aligned on 8 bytes, 0 bytes of padding.
kind_wordi6408 bytesbound_recordsi6488 bytesforwarding_wordi64168 bytesrecord_sizei64248 bytes
Bytes wire form
A wire form of the module contract: one word of a call. Bytes with no description.
Kept_Record_Head record of a module
A record of the module collector: 56 bytes, aligned on 8 bytes, 0 bytes of padding.
seriali6408 bytestime_msi6488 bytessizei64168 byteschain_hashHash(32)2432 bytes
Space_Row record of a module
A record of the module collector: 176 bytes, aligned on 8 bytes, 0 bytes of padding.
spacei6408 byteskind_wordi6488 bytesforwarding_wordi64168 bytesbound_recordsi64248 bytesrecord_sizei64328 byteskepti64408 bytesremovedi64488 bytesrefused_fulli64568 bytes
and 5 more
