aboutsummaryrefslogtreecommitdiffstats
path: root/include/LifecycleManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/LifecycleManager.h')
-rw-r--r--include/LifecycleManager.h61
1 files changed, 47 insertions, 14 deletions
diff --git a/include/LifecycleManager.h b/include/LifecycleManager.h
index 8bf1a2c..914ce0a 100644
--- a/include/LifecycleManager.h
+++ b/include/LifecycleManager.h
@@ -3,27 +3,60 @@
#include "Api.h"
#include "ObjectManager.h"
+/**
+ * @file LifecycleManager.h
+ * @brief Declares monitoring, pinning, cleanup, and contention operations.
+ */
+
namespace nt
{
+ /** @brief Manages runtime lifecycle concerns for registry objects. */
class NT_API LifecycleManager
{
public:
- // If object is not being monitored already, monitors the lifecycle by updating the handle count.
- // Maybe also look at the reference count and kill some categories of disposable objects no longer referenced by other objects, like transactions.
- // One use case is preventing compaction/prunning of history while cursors depend on old database snapshots, for example.
- // Think of other use cases later.
+ /**
+ * @brief Starts monitoring an object's lifecycle.
+ *
+ * If the object is not being monitored already, monitor the lifecycle
+ * by updating the handle count. Maybe also look at the reference count
+ * and kill some categories of disposable objects no longer referenced
+ * by other objects, like transactions.
+ *
+ * One use case is preventing compaction/pruning of history while
+ * cursors depend on old database snapshots, for example. Think of
+ * other use cases later.
+ *
+ * @param object Object to monitor.
+ */
void Monitor(ObjectManager::registry* object);
- // Serializes contention for the change of a mutable reference.
- // This can be used in, for example, the HEAD of a branch to serialize the access.
- // If the object does not causes contention, like a relation (since they are immutable, just like multigroups, all snapshots)
- // then just approve, as they do not cause any contention. Transactions also do not cause any,
- // the only things that do are mutable reference states in shared sessions,
- // for example: the HEAD of a branch, namespace collisions (creating two branches with the same name, or two multigroups with the same name from the same state, etc),
- // multi-branch atomic commits (which I wish to not have as it damages isolation),
- // garbage collection of old state (as in, we want to delete an old-enough history to save up space), etc.
+
+ /**
+ * @brief Serializes contention for changes to mutable references.
+ *
+ * This can be used for the HEAD of a branch to serialize access. If the
+ * object does not cause contention, such as a relation, then this can
+ * approve the operation because relations and multigroups are immutable
+ * snapshots. Transactions also do not cause contention.
+ *
+ * The objects that do cause contention are mutable reference states in
+ * shared sessions. Examples include the HEAD of a branch, namespace
+ * collisions, multi-branch atomic commits (which may damage isolation),
+ * and garbage collection of old state when old-enough history is removed
+ * to save space.
+ *
+ * @param object Object to check for contention.
+ * @return True when the operation may proceed.
+ */
const bool Contention(ObjectManager::registry* object);
- // The inverse of `Monitor`, stops monitoring.
- // Maybe garbage collect here also if the counters goes to zero.
+
+ /**
+ * @brief Stops monitoring an object.
+ *
+ * The inverse of Monitor. Maybe garbage collect here also if the
+ * counters go to zero.
+ *
+ * @param object Object to stop monitoring.
+ */
void Unmonitor(ObjectManager::registry* object);
};
}