Relational NT
A relational database kernel shaped around NT-style object management.
Loading...
Searching...
No Matches
nt::CursorManager::cursor Struct Reference

Active scan state for a single relation. More...

#include <CursorManager.h>

Public Attributes

std::string merkle_root
 Hex hash of the relation's Merkle B-tree root node.
std::vector< std::string > args
 Bound argument values for EPHEMERAL_RELATION cursors.
std::vector< Tuple > page
std::size_t page_position = 0
std::size_t fetch_offset = 0
bool exhausted = false
bool is_ephemeral = false
 True for EPHEMERAL_RELATION cursors; selects the generator-driven page fetch path instead of Merkle B-tree paging.
ObjectManager::ephemeral_object_type::Generator generator
 Generator function for ephemeral cursors.
ObjectManager::registry * pinned_snapshot = nullptr
 Borrowed pointer to the snapshot the cursor is pinning.

Detailed Description

Active scan state for a single relation.

Holds one page of deserialized tuples at a time. When page_position reaches the end of the page, Next() discards the page and fetches the next one from the backend.

The pointer returned by Next() is valid only until the next Next() or Close() call — a page replacement invalidates all prior pointers.

merkle_root is seeded from ObjectManager::Relation::merkle_root at open time and does not change during iteration; the cursor reads the snapshot captured when it was opened.

Notably the cursor does NOT keep a pointer to the HandlerManager handle it was opened from. Everything Next() needs — the relation type, the merkle_root, and the ephemeral generator function — is captured at Open time, so closing the handle before the cursor is exhausted is safe (the API contract still says to close the cursor first, but a violation no longer dereferences a freed handle).

Member Data Documentation

◆ args

std::vector<std::string> nt::CursorManager::cursor::args

Bound argument values for EPHEMERAL_RELATION cursors.

Written by the JOIN operator before each probe; ignored for stored RELATION cursors.

◆ generator

ObjectManager::ephemeral_object_type::Generator nt::CursorManager::cursor::generator

Generator function for ephemeral cursors.

Copied from the ephemeral_object_type at Open time, so the cursor remains valid even if the source registry entry is later torn down (the snapshot pin held in pinned_snapshot prevents that today, but the copy makes the cursor independent regardless).

◆ merkle_root

std::string nt::CursorManager::cursor::merkle_root

Hex hash of the relation's Merkle B-tree root node.

Empty string means the relation contains no tuples.

◆ pinned_snapshot

ObjectManager::registry* nt::CursorManager::cursor::pinned_snapshot = nullptr

Borrowed pointer to the snapshot the cursor is pinning.

Non-null only when a /system/snapshots/<H>/<n> ancestor was found at Open time and LifecycleManager was available. Close unpins it.


The documentation for this struct was generated from the following file: