Release v0.6.0
Changes
This release contains mostly internal changes that should improve the developer experience of
people working on the VM, but also adds some cool new features.
VM
-
Processes now have a more general abstraction, the
Process
trait. It allows us to treat
anything that can receive a "message" as a process. At the moment this can only be a WebAssembly
process or native Rust closures, but it could be extended in the future with other resources
that act as processes. -
Tags were added to messages, allowing for selective receives. A common use case for them is to
make a request to a process and ignore all other messages until the response arrives. This can
be now done by giving the request message a specific tag (i64
value) and waiting for a response
on that tag withlunatic::message::receive
. Thereceive
function will first search the
existing mailbox for the first message matching the tag or block until a message with the
specified tag arrives. If we know that such a tag can't yet exist in the mailbox, we can use the
atomic send and receive operation (send_receive_skip_search
) that will not look through
the mailbox. -
Messages are now just a special kind of signals that a process can receive. Other signals
areKill
,Link
,Unlink
, ... -
A test was added for catching signature changes of host functions.
-
The messaging API was extended, including functions
write_data
andread_data
that
allow for streaming zero-copy message de/serialization. -
The
Environment
was extended with a concept of aregistry
and 3 host functions:
register
,unregister
andlookup
. Processes can now be registered inside the
Environment
under a well known name and version number. When looking up processes inside the
Environment
with a query, the lookup will follow semantic versioning rules for the version.
If we have a process under the name "test" and version "1.2.3", a lookup query with the name
"test" and version "^1.2" will match it. -
Fixed an issue around async Rust cancellation safety and receives with timeouts.
-
Improved handling of command line arguments and environment variables.
Rust library
-
The
Message
trait was removed and we now solely rely on serde'sSerialize
&Deserialize
traits to define what can be a message. Originally I was thinking that this is going to be an
issue once we get support for Rust's nativeTcpStream
and we can't define serde's traits for
it, but this can be solved with remote derives in the future. This removes a really big
and complex macro from the library and allows us to use the newwrite_data
and
read_data
host functions for zero-copy de/serialization. -
MessagePack is now used as the default message serialization format.
-
A request/reply API was added, that was built on the new selective receive functionality.
-
The
Environment
struct was extended with the newregistry
functionality. -
New
lunatic::main
&lunatic::test
macros were added to improve developer experiences. -
lunatic::process::this_env
was added to get the environment that the process was spawned
in.