Watch: Distributed Programming for a Decentralized World (August 2019)
This 15 minute overview is the first in a
4-parts series (opens new window)
of short talks on the Agoric Architecture that overlap substantially with the material in
the sections below.
# Vats: the Unit of Synchrony
The Agoric framework uses the same event loop concurrency model (opens new window) as web browsers and Node.js. Each event loop has a message queue, a call stack of frames, and a heap of objects:
We refer to this combination of an event loop with a message queue, a stack, and a heap as a vat.
Vats are the unit of synchrony. We can only use ordinary synchronous function calls within the same vat. But we can use asynchronous function calls (with eventual send) either within the same vat or between vats. Vats may be on remote machines, including massively replicated machines such as blockchains.
# Parts of the Framework
The framework includes:
E()wrapper function lets you invoke methods within or between vats. Given a local representative (a presence) for a remote object, it sends messages to the origin of the presence.
E(obj).myMethod(...args)is an asynchronous form of
- Objects used across vats are called remotables.
To mark an object for exporting from a vat, use the
- Objects used across vats are called remotables. To mark an object for exporting from a vat, use the
- Notifiers and Subscriptions distribute state change updates. Both deliver an asynchronous stream of messages as a publish-subscribe system might, without requiring explicit management of lists of subscribers. Notifiers are lossy conveyors of non-final values while subscriptions are lossless value conveyors.