The system interface defines which imports are avaible to Webassembly programs running inside Primea.
We define the following types:
i32: same asi32in WebAssemblyi32ptr: same asi32in WebAssembly, but treated as a pointer to a WebAssembly memory offseti32ref: same asi32in WebAssembly, but treated as a reference to a Primea object
Store a message along with it's data and associated capablilities persistently at a given index
Parameters
indexi32 - an index to store the capability atmsgRefi32ref - the reference to the message being stored
Loads a message along with it's data and associated capablilities from persistant storage at a given index
Parameters
indexi32callbacki32ptr - the callback function which is given ani32refof a message containing the loaded data
Returns
- i32ref - the reference to the capability being loaded
Deletes a message from persistant storage at a given index
Parameters
indexi32
Messages can contain data which is read from memory starting at the offset
and going for len bytes.
Parameters
offseti32ptr - a pointer to the location in memory to start reading fromleni32 - the number of bytes to read starting fromoffsetresponseCapi32ref - A capability that is used to send a response. If no response is desired then a negitive integer can be used instead of a referance.
Returns
- i32ref the refence to a the message
Loads the message's data into memory
Parameters
messagei32ref - the reference to the messagewriteOffseti32ptrreadOffseti32ptrleni32
Add a capability reference to a message
Parameters
messagei32ref - the reference to the messageporti32ref - the reference to the capability
get the number of caps contained in the message
Parameters
messagei32ref - the reference to the message
Returns
- i32
loads a capabilities reference from the message
Parameters
messagei32ref - the reference to the messageindexi32 which capability to in the message to load
Returns
- i32
sends a message
Parameters
capi32ref - the reference to the capability to send the messagemessagei32ref - the reference to the messageticksi32 - the number of ticks to allocate to this message
Gets the number of bytes contain in the message's data payload
Parameters
messagei32ref - the reference to the message
Returns
- i32
Gets the tag of the capabilbilty that was used to send the message
Parameters
messagei32ref - The reference to the message
Returns
- i32
Gets the next message from the inbox, if any, while maintaing the current state of the VM.
Parameters
timeouti32 - The amount of ticks to wait before timeing out.timeout_callbacki32ptr - the callback function which is called ifgetNextMessagetimeseout
Sends a response to the current message using its response capability.
Parameters
messagei32Ref - The message to send in response.
Creates a new actor given a message. A message's data field must contain the wasm binary of the new actor.
Parameters
messagei32Ref - The message to send in response.
Mints a new capability to message the minter
Returns
- i32ref the refence to a the capability
test if a given i32 is a valid reference or not
Parameters
messagei32ref
Returns
- i32
deletes a reference
Parameters
messagei32ref