wasm_storage_memory_ns (wasm_storage v0.1.0)
View SourceA namespace in memory: named wasm_storage_memory devices.
It is to wasm_storage_dir what wasm_storage_memory is to a file: for
in-memory databases that still create and delete files (SQLite's journal),
and for tests. Like a memory device it outlives the processes that use it,
until delete/1.
{ok, Ns} = wasm_storage_memory_ns:new(#{}),
{ok, Root} = wasm_storage_ns:root({wasm_storage_memory_ns, Ns}, #{}).With fault_group => Group (from wasm_storage_fault:group/1), every file
is a wasm_storage_fault device of that group, so one plan fails the
operations of every file in turn. crash_image/2 then gives a new namespace
holding what a disk could hold after a crash. Creating, deleting and
renaming files is treated as immediately durable: the model covers file
contents, not directory entries.
The namespace is volatile. sync_directory/2 succeeds.
Its files are ETS tables owned by a small holder process, linked to nothing
and monitoring the creator: files outlive the guest processes that create
them, and go when the creator exits or delete/1 is called.
Summary
Functions
A new namespace with what a disk could hold after a crash now. Files without
a fault device are copied as they are. Mode is that of
wasm_storage_fault:crash_image/2.
Free the namespace and every file in it.
The paths of every file, and their content.
A namespace holding Files ([{Path, Content}]). With fault_group, the
content is the starting durable state of each file's fault device.
Create a namespace owned by the calling process. Option: fault_group.
Types
Functions
A new namespace with what a disk could hold after a crash now. Files without
a fault device are copied as they are. Mode is that of
wasm_storage_fault:crash_image/2.
-spec delete(ns()) -> ok.
Free the namespace and every file in it.
The paths of every file, and their content.
A namespace holding Files ([{Path, Content}]). With fault_group, the
content is the starting durable state of each file's fault device.
Create a namespace owned by the calling process. Option: fault_group.