modus
Menu
On this page

The entry fetch

A web client of this system: TCP in the process, over a segment endpoint with a client grant (src/library/modus/tcp). The root service granted it 10.0.2.100 port 80 and nothing else. In the test of TCP against a stack that this project did not write, QEMU gives that address to a listener of the modus tool on the host (guestfwd): the TCP at the other end is the one of libslirp.

The window shows each case, its answer, and whether it is the expected answer; the log has the same lines and the measures.

What it is for. It shows the shape of a network client in this system: the network service moves segments, and TCP itself (the handshake, the retransmissions, the window) is a library in the process. It also shows that a client grant is narrow: one remote address and one port. A segment to another address, or from a port that the grant does not name, is refused with an error record that names the grant.

What a reader sees. It is not in the start menu: start it with start("fetch") in the console. The window lists the cases: the grant that the network service reports, the two refused segments, the handshake with 10.0.2.100 port 80, then requests of HTTP/1.1 (GET /hello, and larger bodies, with their rates). The log has one line for each case (fetch: GET /hello: status 200, ...), the counts of the connection (segments, retransmissions), then fetch: ok, <count> cases, or fetch: WRONG: <count> of <count> cases.

Its grant: Network: a segment endpoint in the network service, with the client grant of TCP to 10.0.2.100 port

  1. 80. Nothing else: no store, no listen grant.

What it does not prove. It speaks plain HTTP over TCP, with no encryption, to one listener of the tool on the host. The design of the network is in The network: TCP as a library in the process.

fetch module with an entry

Hash
6c176843d9bebb25b234470600d573b497b8b94d1b6c119825d8e1ba7e8318e7
Size
316475 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

A web client of this system: TCP in the process, over a segment endpoint with a client grant (src/library/modus/tcp)

FactValue
KindModules with an entry
Sourcesrc/modules/demonstrations/fetch
Boot imageyes: in the boot image, 316475 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()opens its endpoint, runs every case once, closes the connection, then shows the cases until the process is stopped

entry

entry()

entry opens its endpoint, runs every case once, closes the connection, then shows the cases until the process is stopped.

It takes the secret of its initial sequence numbers from the random generator of the process, opens the segment endpoint and the datagram region that the grant gives, and runs the cases (cases_run). After the summary line it ends the connection and writes fetch: the connection ended, its record is free. With no random seed or no endpoint, it writes the reason on the log and stops with Refused; with no datagram region or no memory for the connections, with Failed.

Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/demonstrations/fetch/main.odin:495

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
GrantsA client grant of TCP to one web server, 10.0.2.100 port 80.
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 1087
  • pages of its threads 72
  • pages of the pictures of its window 3843
  • pages of the module and its imports from the files of the build
  • processes the least
  • threads the least
The least budget of 2048 pages, in which it ran before it stated its window, less that window at the scale 1 (961 pages): its module, its stack, its tables, its window memory and its glyph memory. The tool counts the window at the largest scale. See: Module contract: The budget that a module asks for

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