aboutsummaryrefslogtreecommitdiffstats
path: root/include/LifecycleManager.h
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-06-22 21:58:54 -0300
committerGitHub <noreply@github.com>2026-06-22 21:58:54 -0300
commit663586b8d07c979218ceff79576bb549ee1973c5 (patch)
tree8a7dabebe05d0c1ac7a509e8dcf6762364c0c095 /include/LifecycleManager.h
parent9f0e1c642680c69e10eb1760be07984f9ecc6d39 (diff)
downloadRNT-663586b8d07c979218ceff79576bb549ee1973c5.tar.gz
RNT-663586b8d07c979218ceff79576bb549ee1973c5.zip
Ephemeral relationsmaster-old
Diffstat (limited to '')
-rw-r--r--include/LifecycleManager.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/LifecycleManager.h b/include/LifecycleManager.h
index c1e63d8..daf82dd 100644
--- a/include/LifecycleManager.h
+++ b/include/LifecycleManager.h
@@ -96,6 +96,24 @@ namespace nt {
bool IsEligibleForGC(ObjectManager::registry* object) const;
/**
+ * @brief Forces a GC attempt on an object without decrementing a counter.
+ *
+ * Runs the same eligibility check, type-specific cascade, and Unregister
+ * as Unmonitor / Unpin, but is callable directly. No-op when the object
+ * is still referenced (either counter non-zero) or is a named-lifetime
+ * type (BRANCH / SESSION).
+ *
+ * Used by the session-close path to collect scratch ephemerals that were
+ * never session-pinned and whose consuming cursor has already closed, and
+ * (later) by the idle reaper to sweep named entries after Unpinning their
+ * session-ownership pin.
+ *
+ * @param object Object to attempt to collect.
+ * @return True when the object was eligible and collected.
+ */
+ bool Collect(ObjectManager::registry* object);
+
+ /**
* @brief Serializes contention for changes to mutable reference states.
*
* Immutable objects — relation snapshots, multigroup snapshots,
@@ -156,6 +174,18 @@ namespace nt {
*/
void CascadeBranchTree(ObjectManager::registry* branch_tree);
+ /**
+ * @brief Releases pins an EPHEMERAL_RELATION holds on its base relations.
+ *
+ * An ephemeral relation Pins every entry named in its `dependencies`
+ * list at registration time (a stored or ephemeral base cannot be GC'd
+ * while something is defined atop it). When the ephemeral itself becomes
+ * eligible for GC, this resolves each dependency path and Unpins it.
+ * Dependency paths are stored slash-joined with no leading slash and
+ * split on '/' to address the registry. Called only from TryCollect.
+ */
+ void CascadeEphemeral(ObjectManager::registry* ephemeral);
+
ObjectManager& objects_;
IStorageBackend& storage_;
};