Reference

Built-in objects

The objects the runtime implements, and the shapes they are made of. Console, Listener and Files are the only way any object reaches the world outside the image: the image being run gets one by needing it, needs /net/tcp Listener, and the runtime picks how to run it. The others touch nothing outside the image, and any image can declare one by its name. They are declared in the runtime's own header, env, and this page is generated from it.

Console

A console: lines in, and anything out. The runtime runs it on the host's stdin and stdout.

Whatever is written to it is printed on a line of its own: text as it is, a stat record as its fields, and anything else as its content type and length.

Serves

Path Requests
/ watch -> text/plain*, write */* Watch for every line of input, until it ends; write to print.

Listener

A listener, and the connections it accepts. The runtime runs it as a TCP listener on the address the image configures it with.

Serves

Path Requests
/ operator write text/plain Configured by the image only, with the address to listen on, e.g. "127.0.0.1:8080".
/address read -> text/plain The bound address, e.g. "127.0.0.1:8080".
/accept watch -> text/plain* The name of every connection accepted, as it is.
/{conn}/data watch -> application/octet-stream*, write application/octet-stream A connection's bytes: watch for those received, until the peer closes; write to send.
/{conn}/remote read -> text/plain The peer's address.
/{conn} remove Close our side, once everything written is sent.

Files

Read-only access to one directory on the host, and nothing above it.

A file's content type comes from its extension. Reading a directory answers is_directory, and a listing is sorted by name.

Serves

Path Requests
/ operator write text/plain, read -> */*, stat, list Configured by the image only, with the directory to serve, relative to the image.
/** read -> */*, stat, list

MemoryConsole

A console in memory, which touches nothing on the host, to give an image where it would be given the real one.

Implements Console, Terminal.

Serves

Path Requests
/ watch -> text/plain*, write */* Watch for every line of input, until it ends; write to print.
/typed write text/plain Type a line, as if on stdin.
/printed watch -> */** Everything written to the console, as it is written.

MemoryListener

A listener in memory, which touches nothing on the host, to give an image where it would be given a real one. Connections come from /dial.

Implements Listener, Dialer.

Serves

Path Requests
/ operator write text/plain Configured by the image only, with the address to listen on, e.g. "127.0.0.1:8080".
/address read -> text/plain The bound address, e.g. "127.0.0.1:8080".
/accept watch -> text/plain* The name of every connection accepted, as it is.
/{conn}/data watch -> application/octet-stream*, write application/octet-stream A connection's bytes: watch for those received, until the peer closes; write to send.
/{conn}/remote read -> text/plain The peer's address.
/{conn} remove Close our side, once everything written is sent.
/dial create application/octet-stream -> application/octet-stream* Connect, sending the request's bytes, and get back everything the server writes, until it closes the connection.

PackedFiles

Files packed into the image when it was built, by its includes. It answers as Files does.

Implements FileTree.

Serves

Path Requests
/** read -> */*, stat, list

Shapes

Traits and protocols the objects above are made of, for headers to use.

Dialer

The other side of a listener in memory: connect to it.

Path Requests
/dial create application/octet-stream -> application/octet-stream* Connect, sending the request's bytes, and get back everything the server writes, until it closes the connection.

FileTree

A tree of files, read-only.

Path Requests
/** read -> */*, stat, list

Terminal

The other side of a console in memory: type lines into it, and watch what it prints.

Path Requests
/typed write text/plain Type a line, as if on stdin.
/printed watch -> */** Everything written to the console, as it is written.

TestSuite

Something with tests to run, which othismo test finds by this trait and runs, each in a fresh run of the image.

Path Requests
/tests list The tests, a stat record each.
/tests/{name} write Runs a test, and answers ok if it passed, or an error, conventionally invalid, whose description says why it didn't.

Protocols

Protocol Requests
Connection watch -> application/octet-stream*, write application/octet-stream A stream of bytes each way.
Dir list, stat Something listed.
File read -> */*, stat Something read whole.