aboutsummaryrefslogtreecommitdiffstats
path: root/include/LifecycleManager.h
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-05-08 21:20:01 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-05-08 21:20:01 -0300
commitdbad4b699e35442920baa60c13f76e95904fe317 (patch)
tree70e35b6879349a750ea5be0b02790bb8d32d00b1 /include/LifecycleManager.h
parent602af97c269bdc211cc7aeb34e436152053395cc (diff)
downloadRNT-dbad4b699e35442920baa60c13f76e95904fe317.tar.gz
RNT-dbad4b699e35442920baa60c13f76e95904fe317.zip
restructure project and add readme
Diffstat (limited to '')
-rw-r--r--include/LifecycleManager.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/LifecycleManager.h b/include/LifecycleManager.h
new file mode 100644
index 0000000..2cd270d
--- /dev/null
+++ b/include/LifecycleManager.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "Api.h"
+#include "ObjectManager.h"
+
+namespace nt
+{
+ 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.
+ // Think of other use cases later.
+ 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.
+ const bool Contention(ObjectManager::registry* object);
+ // The inverse of `Monitor`, stops monitoring.
+ // Maybe garbage collect here also if the counters goes to zero.
+ void Unmonitor(ObjectManager::registry* object);
+ };
+}