metacore Start a pilot

Developers · Extend

An atom, as one WebAssembly file.

The same atom as one WebAssembly file, which the platform runs in a sandbox with no access to data, the network or secrets. Any language that compiles to WebAssembly with WASI writes one, with no library of the platform.

Modules

The same atom as one WebAssembly file, which the platform runs in a sandbox. Each call has a limit of memory and of fuel. metacore atom test runs a module on your machine as a cell does.

Program

A plain program, with no library of ours.

A module takes the name of a procedure, reads the request from its input and writes the answer to its output. The engine makes the same calls as to a server, and does the same with an answer.

For each callWhat a module does
ArgumentsThe name of the connection and the procedure. There is no environment variable.
InputThe request of the procedure, in the binary form of Protocol Buffers.
OutputThe response, in the same form. The module ends with the code 0: that is its answer.
RefusalThe code 1 refuses the call, with the reason on its standard error.
A new startEach call starts the module anew. Nothing passes from one call to the next.

A command of WASI

Most languages build one. metacore atom doc module prints the whole contract: the streams, the exit codes and the clock.

Terminal
$ metacore atom test rules.wasm \
    --procedure metacore.atom.v1.HostService/Ping
outcome   answered
fuel      28212860
memory    9 MiB
time      9.807791ms
message   -
response  {}

The same sandbox, on your machine

metacore atom test runs a module as a cell does, with the same limits and the same fuel. It needs no sign-in.

Sandbox

Nothing to host.

A module stands in for a server: it answers every atom that names its connection. An org then hosts nothing.

In the sandboxHow it works
No accessNo network, no file and no secret. A module sees its request alone.
Memory and fuelA binding gives each call its memory and its fuel. Fuel counts instructions, never time, so a busy node changes nothing.
Same answerThe same request gives the same answer, at the same cost: a retry reads the same clock and draws the same random bytes.
FailuresA module that runs out of memory, fuel or time fails its call, and the failure says which.
Third partiesA module asks a third party over HTTP through the engine, with a secret that your org keeps.

What a module can and cannot do

A call that is cut in the middle did nothing outside. The engine makes it again, and its outcome is never unknown.

In a cellHow it runs
Compiled onceA cell compiles a module when it takes it. A connection binds only to a ready module, so no call waits for a compile.
One workerOne process for one connection of one domain in one environment, never used for another.
Who decidesA cell runs modules by process, by microVM, or not at all. Whoever runs the cell says which.
Never weakerA cell that cannot run modules the way it must runs none.
A moveA domain that moves takes its modules to its new cell, with what was compiled of them.

How a cell runs it

An export holds each module as the WebAssembly file itself.

Module

Named by its digest, in every environment.

Upload a module to a domain, then bind a connection to it by its digest. The same file has the same digest in staging and in production, so a promotion proves what it binds.

One module, in staging

A module also takes a name for people, such as the program it is built from. The domain keeps it while a connection is bound to it, and the audit trail records each upload and each removal.

Lifecycle

Compiling, ready or failed.

The cell checks a module before it keeps it, then compiles it once. A file that asks for more than a module reaches is refused, with every problem.

  1. metacore module create rules.wasmUploaded, checked and compiled. The command waits until the module is ready.
  2. metacore connection bind rules --module DIGESTThe connection runs the module from its next call.
  3. metacore connection check rulesThe cell runs the module once, and reports the fuel, the memory and the time that it used.
  4. metacore connection get rulesThe most fuel, memory and time that one call used, since the last change of the connection.

From a file to a call

An admin changes a binding from a server to a module, or back, at any time. The schema is the same either way.

StateWhat it means
CompilingThe cell compiles the module once, as the domain takes it. The calls of a connection that is bound to it wait meanwhile, and spend no attempt.
ReadyThe cell holds it compiled for every run after. A call starts it at once, and a connection can be bound to it.
FailedThe module does not compile, and says why. Its file never compiles: only another file makes a module that runs.

Where a compile stands

A restart or a new instance of the platform compiles nothing again.

See also

Build your domain.

Declare its schema, and take it to production, self-hosted or in a managed region.

Briefing