wasm_storage_owner (wasm_storage v0.1.0)
View SourceBEAM-local ownership of storage resources.
A database engine running in a guest assumes it is the only writer of its
files. This registry makes that true inside one BEAM node: a process takes
exclusive or shared ownership of a resource identity, and the registry
releases it when the process exits, however it exits.
This is not an operating-system lock. Another BEAM node, or any other OS process, can still open the same file. See the storage contract.
A resource identity is any term. wasm_storage_file:identity/2 gives the
identity of a file (its device and inode), so two paths that name the same
file conflict.
Summary
Functions
Take ownership of Identity for the calling process.
The mode and the processes that hold Identity.
Release the calling process's ownership of Identity.
Turn the caller's shared ownership into exclusive.
Types
Functions
Take ownership of Identity for the calling process.
exclusive conflicts with every other holder. shared conflicts only with
an exclusive holder. Taking a resource the caller already holds in the same
mode is a no-op. Ownership is released by release/1 or when the caller
exits.
The mode and the processes that hold Identity.
-spec release(term()) -> ok.
Release the calling process's ownership of Identity.
Turn the caller's shared ownership into exclusive.
It succeeds only when the caller is the only holder. It never waits.