modus
Menu
On this page

The entry merge

merge joins several streams of one record into one . Its record input sources is generic, of the count Many: the first wiring fixes its record, and each later source must have the same one, which the root service checks. Its record output merged takes that record.

It writes each record of each source in the order in which it reads them: the rings are read in turn, each in its own order, and no order across sources is given. merged has serials of its own:

  • a gap record of a source becomes a gap record of merged with the same count;
  • a joined record of a source that is not 0 becomes a gap record of its count, so the reader of merged knows what the sources lacked;
  • when each source ended, merged ends: clean when each source ended with a clean end record, else with the first error record. A source that ended by an end word (its writer stopped, a revocation) or that the library refused gives the record State of the unit Wirings, whose value is that end word, or the refusal of the record.

It waits for room in each ring of merged: a slow reader of merged holds merge, and the pace of each source then says whether that source waits or loses records with a gap. merge never waits for a time.

Start: in a wiring list, start("merge", wire(alpha.out, merge.sources) + wire(beta.out, merge.sources)), then read merge.merged. What a reader sees: no window; the records of the sources in merged. It stops itself with Done when merged ended.

See: Record outputs and record inputs of a module: typed streams of records between processes: Generic record inputs and the utility modules in the repository

merge module with an entry

Hash
69f3062606df4eca7ce275bd37b79b244d3d0ff68bfc5812d9ed2c5037a22dd8
Size
57344 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

merge joins several streams of one record into one

FactValue
KindModules with an entry
Sourcesrc/modules/libraries/merge
Boot imageyes: in the boot image, 57344 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
entry()

entry

entry()
Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/libraries/merge/main.odin:46

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
GrantsnoneThe utility modules of the record streams: their ends come in their wiring rings, and they need no grant.
Other terms of its start grant setnone
Budget that it asks for
  • the least budget
No MODULE_BUDGET in its source: it asks for the least budget.

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

merged global variable of the package merge

merged: system.Record_Output(system.Any_Record)

The records of each source, in the order in which merge read them.

src/modules/libraries/merge/main.odin:40