Exo "cheat sheet" #9651
0xpatrickdev
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been working with the exo api a lot lately and wanted to share a quick "cheat sheet" of what to reach for and when. Please note I am merely a consumer of the library so this may contain inaccuracies - if you see any errors or areas for improvement, please comment!
Agoric Zone API Quick Guide
This guide provides an overview of key components in the exo API. Please note that this guide may contain simplifications, and you should refer to the official documentation for complete information.
Key Components
zone.mapStore()
zone.exo()
Far
is how we mark an object to be exposed for remote interaction.zone.exoClass()
state
recordmakeFoo
) that creates instances of the classstate
recordmakeFoo
function's parameters match the initialization function's parameterszone.exoClassKit()
zone.exoClass()
Record<string, Record<string, Fn>>
instead of justRecord<string, Fn>
)kit.holder
)Important Considerations
Durability
Determined by the zone passed to it - typically heap zone or durable zone bound to baggage.
State
All exo state needs to be Passable
Prepare-time Semantics
zone.exo()
,zone.exoClass()
andzone.exoClassKit()
are typically wrapped in prepare functions which need to return synchronously.zone.exo()
creates an instance directly, where zone.exoClass() and zone.exoClassKit() returnmake*()
functions for creating an instance of the class.Synchronous Prelude
await
in a function, and is used to explainawait
safety rules.await null
is used in the top-level of functions that rely on synchronous calls before the firstawait
, to ensure an empty stack. Without this, there is no guarantee that the synchronous calls happen promptly.Beta Was this translation helpful? Give feedback.
All reactions