Module hb_store_fs.erl¶
A key-value store implementation, following the hb_store
behavior
and interface.
Description¶
This implementation utilizes the node's local file system as its storage mechanism, offering an alternative to other store's that require the compilation of additional libraries in order to function.
As this store implementation operates using Erlang's native file
and
filelib
mechanisms, it largely inherits its performance characteristics
from those of the underlying OS/filesystem drivers. Certain filesystems can
be quite performant for the types of workload that HyperBEAM AO-Core execution
requires (many reads and writes to explicit keys, few directory 'listing' or
search operations), awhile others perform suboptimally.
Additionally, thisstore implementation offers the ability for simple
integration of HyperBEAM with other non-volatile storage media: hb_store_fs
will interact with any service that implements the host operating system's
native filesystem API. By mounting devices via FUSE
(etc), HyperBEAM is
able to interact with a large number of existing storage systems (for example,
S3-compatible cloud storage APIs, etc).
Function Index¶
add_prefix/2* | Add the directory prefix to a path. |
list/2 | List contents of a directory in the store. |
make_group/2 | Create a directory (group) in the store. |
make_link/3 | Create a symlink, handling the case where the link would point to itself. |
read/1* | |
read/2 | Read a key from the store, following symlinks as needed. |
remove_prefix/2* | Remove the directory prefix from a path. |
reset/1 | Reset the store by completely removing its directory and recreating it. |
resolve/2 | Replace links in a path successively, returning the final path. |
resolve/3* | |
scope/0 | The file-based store is always local, for now. |
scope/1 | |
start/1 | Initialize the file system store with the given data directory. |
stop/1 | Stop the file system store. |
type/1* | |
type/2 | Determine the type of a key in the store. |
write/3 | Write a value to the specified path in the store. |
Function Details¶
add_prefix/2 *¶
add_prefix(X1, Path) -> any()
Add the directory prefix to a path.
list/2¶
list(Opts, Path) -> any()
List contents of a directory in the store.
make_group/2¶
make_group(Opts, Path) -> any()
Create a directory (group) in the store.
make_link/3¶
make_link(Opts, Link, New) -> any()
Create a symlink, handling the case where the link would point to itself.
read/1 *¶
read(Path) -> any()
read/2¶
read(Opts, Key) -> any()
Read a key from the store, following symlinks as needed.
remove_prefix/2 *¶
remove_prefix(X1, Path) -> any()
Remove the directory prefix from a path.
reset/1¶
reset(X1) -> any()
Reset the store by completely removing its directory and recreating it.
resolve/2¶
resolve(Opts, RawPath) -> any()
Replace links in a path successively, returning the final path. Each element of the path is resolved in turn, with the result of each resolution becoming the prefix for the next resolution. This allows paths to resolve across many links. For example, a structure as follows:
/a/b/c: "Not the right data" /a/b -> /a/alt-b /a/alt-b/c: "Correct data"
will resolve "a/b/c" to "Correct data".
resolve/3 *¶
resolve(Opts, CurrPath, Rest) -> any()
scope/0¶
scope() -> any()
The file-based store is always local, for now. In the future, we may want to allow that an FS store is shared across a cluster and thus remote.
scope/1¶
scope(X1) -> any()
start/1¶
start(X1) -> any()
Initialize the file system store with the given data directory.
stop/1¶
stop(X1) -> any()
Stop the file system store. Currently a no-op.
type/1 *¶
type(Path) -> any()
type/2¶
type(Opts, Key) -> any()
Determine the type of a key in the store.
write/3¶
write(Opts, PathComponents, Value) -> any()
Write a value to the specified path in the store.