modus
Menu
On this page

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

FactValue
KindModules with an entry
Sourcesrc/modules/system/collector
Boot imageyes: in the boot image, 299008 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
act_record_count() -> Integerreturns the number of hash-chained act records of wide grants stored in the collector
active_grant_count() -> Integerreturns the number of currently active wide grants
status(out: Collector_Status) -> Integerwrites aggregate collector and wide-grant counters into out
verify_chain(out: Chain_Verification_Report) -> Integerwalks the full hash-chained act store and reports integrity
act_records_read(grant: Integer, first: Integer, last: Integer, result: Table(Act_Record, Append)) -> Integergives 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) -> Integergives the space of a source and one of its record outputs, with its terms
record_append(space: Integer, record: Bytes(Read)) -> Integerkeeps 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)) -> Integergives 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) -> Integergives the state of one space: its terms, its counts and its last link
space_verify(space: Integer) -> Integerwalks the chain of an audit space in memory, then reads each of its segments back from the private store and compares it
source_count() -> Integergives the sources that have a space
record_count() -> Integergives 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.

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

active_grant_count

active_grant_count() -> 

active_grant_count returns the number of currently active wide grants.

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

status

status(out: ) -> 

status writes aggregate collector and wide-grant counters into out.

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

verify_chain

verify_chain(out: ) -> 

verify_chain walks the full hash-chained act store and reports integrity.

Parameters
  • out:
Result
When it fails
a negative result, and the error record
Source
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.

Parameters
  • grant:
  • first:
  • last:
  • result: (, Append)
Result
When it fails
a negative result, and the error record
Source
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.
Source
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.

Parameters
  • source:
  • output:
  • terms:
Result
When it fails
a negative result, and the error record
Source
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.

Parameters
  • space:
  • record: (Read)
Result
When it fails
a negative result, and the error record
Source
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.

Parameters
  • space:
  • after:
  • limit:
  • heads: (, Append)
  • bytes: (Append)
Result
When it fails
a negative result, and the error record
Source
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.

Parameters
none
Result
()
When it fails
a negative result, and the error record
Source
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.

Parameters
  • space:
  • out:
Result
When it fails
a negative result, and the error record
Source
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.

Parameters
  • space:
Result
When it fails
a negative result, and the error record
Source
src/modules/system/collector/spaces.odin:354

source_count

source_count() -> 

source_count gives the sources that have a space.

Parameters
none
Result
When it fails
a negative result, and the error record
Source
src/modules/system/collector/spaces.odin:370

record_count

record_count() -> 

record_count gives the records that the spaces keep now.

Parameters
none
Result
When it fails
a negative result, and the error record
Source
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

WhatValueAs the root service says
GrantsThe 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 seton_demand = true
Budget that it asks for
  • working memory pages 256
  • 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 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 bytes
  • uniti6488 bytes
  • operationi64168 bytes
  • argumenti64248 bytes
  • valuei64328 bytes
  • limiti64408 bytes
  • foundi64488 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 bytes
  • total_grants_createdi6488 bytes
  • total_grants_revokedi64168 bytes
  • total_grants_expiredi64248 bytes
  • total_acts_permittedi64328 bytes
  • total_acts_blockedi64408 bytes
  • recorded_actsi64488 bytes
  • refused_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 bytes
  • failing_indexi6488 bytes
  • record_counti64168 bytes
  • verify_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 bytes
  • grant_serialu6488 bytes
  • timestamp_msu64168 bytes
  • act_kind_wordu64248 bytes
  • target_window_idu64328 bytes
  • detail_word_0u64408 bytes
  • detail_word_1u64488 bytes
  • previous_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 bytes
  • bound_recordsi6488 bytes
  • forwarding_wordi64168 bytes
  • record_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 bytes
  • time_msi6488 bytes
  • sizei64168 bytes
  • chain_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 bytes
  • kind_wordi6488 bytes
  • forwarding_wordi64168 bytes
  • bound_recordsi64248 bytes
  • record_sizei64328 bytes
  • kepti64408 bytes
  • removedi64488 bytes
  • refused_fulli64568 bytes

and 5 more