Host interface
Faasm functions can interact with the Faasm runtime and underlying host through the host interface. This lets them do things like manage state and interact with other functions.
The host interface includes:
Function input/output and chaining
These cover interactions with serverless functions and their ability to invoke other functions (“chaining”).
Function |
Description |
---|---|
|
Read input data as byte array |
|
Write output data for function |
|
Call function by name and return |
|
Call function pointer and return |
|
Await completion of |
|
Await completion and get output of |
State
This section of the host interface covers management of state as outlined in the state docs.
Function |
Description |
---|---|
|
Get pointer to state value for |
|
Get pointer to state value for |
|
Set state value for |
|
Set |
|
Push/pull global state value for |
|
Push/pull global state value for |
|
Append data to state value for |
|
Lock local copy of state value for |
POSIX-like calls and WASI
Faasm supports WASI, but adds and customises further POSIX-like system calls to support a broader range of legacy applications and libraries (such as CPython).
This is done in part with a modified wasi-libc.
The main additions and modifications are as follows:
Category |
Function |
Description |
---|---|---|
Dynamic linking |
|
Standard POSIX-like dynamic linking |
Dynamic linking |
|
As above |
Memory |
|
Only permits memory growth and file mapping |
File I/O |
|
Necessary for certain legacy applications |
Faasm supports standard filesystem syscalls, but provides a serverless-specific implementation. Because functions may be executing on different hosts, all filesystem accesses are global-read-local-write, i.e. functions can access files from any host, but writes are only made locally. This is sufficient to support legacy filesystem use-cases, while any data sharing between functions can be done through state.
As mentioned above, Faasm also supports pthreads, which also introduce a number of extra POSIX syscalls.