The system interface defines which imports are avaible to Webassembly programs running inside Primea.
We define the following types:
i32
: same asi32
in WebAssemblyi32ptr
: same asi32
in WebAssembly, but treated as a pointer to a WebAssembly memory offseti32ref
: same asi32
in 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
index
i32 - an index to store the capability atmsgRef
i32ref - 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
index
i32callback
i32ptr - the callback function which is given ani32ref
of 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
index
i32
Messages can contain data which is read from memory starting at the offset
and going for len
bytes.
Parameters
offset
i32ptr - a pointer to the location in memory to start reading fromlen
i32 - the number of bytes to read starting fromoffset
responseCap
i32ref - 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
message
i32ref - the reference to the messagewriteOffset
i32ptrreadOffset
i32ptrlen
i32
Add a capability reference to a message
Parameters
message
i32ref - the reference to the messageport
i32ref - the reference to the capability
get the number of caps contained in the message
Parameters
message
i32ref - the reference to the message
Returns
- i32
loads a capabilities reference from the message
Parameters
message
i32ref - the reference to the messageindex
i32 which capability to in the message to load
Returns
- i32
sends a message
Parameters
cap
i32ref - the reference to the capability to send the messagemessage
i32ref - the reference to the messageticks
i32 - the number of ticks to allocate to this message
Gets the number of bytes contain in the message's data payload
Parameters
message
i32ref - the reference to the message
Returns
- i32
Gets the tag of the capabilbilty that was used to send the message
Parameters
message
i32ref - 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
timeout
i32 - The amount of ticks to wait before timeing out.timeout_callback
i32ptr - the callback function which is called ifgetNextMessage
timeseout
Sends a response to the current message using its response capability.
Parameters
message
i32Ref - 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
message
i32Ref - 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
message
i32ref
Returns
- i32
deletes a reference
Parameters
message
i32ref