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 keyP ‖ k, the prefixPis the packedi64at the front of the key. - find
- Find the allocated prefix of the node at
path(the layer’sfind, verbatim): walk from the root node; a missing child row stops the walk withOk(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 thenode_containing_keyreverse 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’slist). - list_
children_ async - Asynchronous counterpart to
list_children. - prefix_
data_ region_ occupied - The
get_prefixrange 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
pathand its entire subtree (the layer’sremove_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.