The best way to understand the purpose of makeOnce
is to first understand
what makeOnce
does on a durable zone. Used correctly, makeOnce
should only
be called at most once on any zone,key pair during any vat incarnation.
Given that constraint, if there is already a value bound to that
zone,key pair, it must have been left there by a previous incarnation and
makeOnce
will simply return it. If not, then maker(key)
is called to
determine the initial value of that slot, which will normally be preserved
by similar calls to makeOnce
in future incarnations --- though that will be
up to them.
Also ensures the maker returns a storable value.
The value of the key's slot.
Ensure the wrapped function is only called once per incarnation. It is expected to update the backing store directly.
Optional
labelToKeys: ((label: string) => string[]) = defaultLabelToKeys
Only used internally for diagnostics, not available to user code