Aller au contenu
Bienvenue sur la nouvelle documentation de CppUtils !

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

Paramètre templateDescription
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.

ParamètreDescription
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.

ParamètreDescription
nodeNode handle to track.

Retourne : 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.

ParamètreDescription
nodeNode to keep focused.
distanceHop radius around node to preload and retain in memory.

Retourne : 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.

ParamètreDescription
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. | Paramètre | Description | | :--- | :--- | | nodeId | Persistent identifier of the node to load. |

Retourne : 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.

ParamètreDescription
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.

ParamètreDescription
nodeIdPersistent identifier of the node to delete.