Skip to main content

Module ops

Module ops 

Source
Expand description

The directory operations over a RawKv view: the version check, node lookup, lazy creation, child listing, and recursive removal.

Each function ports the corresponding DirectoryLayer algorithm (pinned foundationdb-0.11.0) onto the flat layout’s row forms. The flat single-writer view makes the layer’s transactional structure trivial: every operation below is one flat transaction; FDB’s version-vector and conflict-range machinery has no flat analogue.

Paths are the layer’s paths — &[&[u8]] of segments, UTF-8 enforced by the caller at the fasm API boundary (validate_dir) and re-checked here where a segment is packed as a string element.

Functions§

check_version
Read and enforce the store’s version row (the layer’s check_version, verbatim):
check_version_async
Asynchronous counterpart to check_version.
check_version_read
The read-only half of check_version: enforce the version row without writing it. Read operations pay this one point read per call (the layer’s per-entry-point cost).
check_version_read_async
Asynchronous counterpart to check_version_read.
create_or_open
Open (and optionally create) the directory at path, returning its allocated prefix.
create_or_open_async
Asynchronous counterpart to create_or_open.
data_key_prefix
The raw key that owns a data key (the layer’s node_containing_key): for a data key P ‖ k, the prefix P is the packed i64 at the front of the key.
find
Find the allocated prefix of the node at path (the layer’s find, verbatim): walk from the root node; a missing child row stops the walk with Ok(None) — missing parents are not errors.
find_async
Asynchronous counterpart to find.
is_prefix_free
Whether an allocated prefix is free (the layer’s is_prefix_free, verbatim): the prefix is free when (a) no existing node’s child rows could own a key in the prefix’s data region — checked by the node_containing_key reverse scan over the node region, and (b) the prefix’s own node subspace holds no rows.
is_prefix_free_async
Asynchronous counterpart to is_prefix_free, using bounded limit-1 scans.
list_children
List the immediate children of the directory with allocated prefix prefix, sorted by name (the layer’s list).
list_children_async
Asynchronous counterpart to list_children.
prefix_data_region_occupied
The get_prefix range probe: whether the candidate’s data region [prefix ‖ 0x00, prefix ‖ 0xFF] holds any row (verbatim: a limit-1 range read; the flat view counts).
prefix_data_region_occupied_async
Asynchronous counterpart to prefix_data_region_occupied, using a limit-1 scan.
remove_dir
Remove the directory at path and its entire subtree (the layer’s remove_internal + remove_recursive + remove_from_parent, verbatim operation order): recurse into every child, clear the directory’s data region, clear the node’s own rows, then delete the child row in the (re-found) parent, tolerating a missing parent.
remove_dir_async
Asynchronous counterpart to remove_dir.
validate
A whole-store walk that validates every row against the layout.
validate_async
Asynchronous counterpart to validate.