Skip to content
Welcome to the new CppUtils documentation!

Disk-backed pager that persists, tracks, and lazily loads MeshNodePtr graphs via IndexedStorage.

Template parameterDescription
KeyBranch key type.
ValueNode payload value type.
using CppUtils::FileSystem::MeshPager<Key, Value>::MeshNodePtr = Container::MeshNodePtr<Key, Value, Policy>;
explicit MeshPager::MeshPager(std::filesystem::path directory, std::optional<std::size_t> maxChunkSize = std::nullopt);

Opens or initializes a pager backed by directory.

ParameterDescription
directoryDirectory where IndexedStorage chunks and index files are stored.
maxChunkSizeOptional maximum chunk file size in bytes (defaults to 64 MiB).
MeshPager::~MeshPager();

Unloads all currently loaded nodes to disk on destruction.

auto MeshPager::track(MeshNodePtr node) -> std::size_t;

Registers node with the pager, assigning a persistent ID and Policy if needed.

ParameterDescription
nodeNode handle to track.

Returns: Persistent node ID (or 0 if node is null).

[[nodiscard]] auto MeshPager::acquireFocus(MeshNodePtr node, std::size_t distance = 1) -> ScopedFocus;

Tracks node and returns an RAII ScopedFocus keeping its neighborhood up to distance hops in RAM.

ParameterDescription
nodeNode to keep focused.
distanceHop radius around node to preload and retain in memory.

Returns: ScopedFocus guard that releases the focus on destruction.

auto MeshPager::updateFocuses() -> void;

Recomputes active focus neighborhoods, loading missing neighbors and unloading out-of-focus nodes.

Synchronizes known persistent link IDs from node’s in-memory branches, assigning IDs to newly linked neighbors.

ParameterDescription
nodeLoaded node whose outgoing links should be indexed.
auto MeshPager::loadNode(std::size_t nodeId) -> MeshNodePtr;

Loads a node by nodeId from disk (or returns the already-loaded instance).

Loaded nodes remain cached in RAM until unloaded explicitly or by a focus update. | Parameter | Description | | :--- | :--- | | nodeId | Persistent identifier of the node to load. |

Returns: Loaded MeshNodePtr, or a null handle if nodeId is not found in storage.

auto MeshPager::unloadNode(std::size_t nodeId) -> void;

Serializes and stores nodeId to disk, then evicts its strong reference from RAM.

ParameterDescription
nodeIdPersistent identifier of the node to unload.
auto MeshPager::removeNode(std::size_t nodeId) -> void;

Permanently removes nodeId from memory, known link tables, and disk storage.

ParameterDescription
nodeIdPersistent identifier of the node to delete.