aboutsummaryrefslogtreecommitdiffstats
path: root/src/HandlerManager.cpp
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-07-02 00:31:57 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-07-02 00:31:57 +0000
commitab70e5461b98ddf2b56268c53c171cab89157027 (patch)
tree3e57218edacc8e1366e0d1a86bdb922af7e51dca /src/HandlerManager.cpp
parenta4f6637601548a7158869ad155f29db50b151823 (diff)
downloadRNT-ab70e5461b98ddf2b56268c53c171cab89157027.tar.gz
RNT-ab70e5461b98ddf2b56268c53c171cab89157027.zip
Nuke the old code
Diffstat (limited to 'src/HandlerManager.cpp')
-rw-r--r--src/HandlerManager.cpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/HandlerManager.cpp b/src/HandlerManager.cpp
deleted file mode 100644
index 505b393..0000000
--- a/src/HandlerManager.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "HandlerManager.h"
-
-#include "IdentityManager.h"
-#include "LifecycleManager.h"
-#include "NamespaceReferenceManager.h"
-#include "PermissionsManager.h"
-
-namespace nt {
- void HandlerManager::DeallocateHandle(struct handle* handle) {
- delete handle;
- }
-
- HandlerManager::HandlerManager(ObjectManager& objects, PermissionsManager& permissions,
- IdentityManager& identities, LifecycleManager& lifecycles,
- NamespaceReferenceManager& references)
- : objects_(objects), permissions_(permissions), identities_(identities),
- lifecycles_(lifecycles), references_(references) {
- }
-
- struct HandlerManager::handle* HandlerManager::Open(std::vector<std::string> object_path,
- void* connection_context) {
- const auto resolved = references_.Resolve(std::move(object_path));
- ObjectManager::registry* retrieved_object = objects_.Find(resolved);
- if (permissions_.Access(retrieved_object, (const void*)connection_context) &&
- identities_.CanOpen(retrieved_object) && lifecycles_.Contention(retrieved_object)) {
- // Starts monitoring this guy
- lifecycles_.Monitor(retrieved_object);
- return new handle{retrieved_object, connection_context}; // Return a successful handle
- } else {
- // Return something more algebraic instead of null or an int
- return nullptr;
- };
- }
-
- bool HandlerManager::Close(struct handle* handle) {
- if (handle == nullptr) {
- return false;
- }
- // Somehow grab the object pointer and connection (maybe drop it...) from the handle
- ObjectManager::registry* object = handle->object;
- void* connection_context = handle->connection_context;
- // Checking for permissions here may be relevant.
- // What if we have a handle but no permission? Spooky
- if (permissions_.Access(object, connection_context) && identities_.CanClose(object)
- // TODO: I think that in this case we do not need to worry about contention.
- // But be careful to evaluate this scenario later.
- //&& lifecycles_.Contention(object)
- ) {
- // Stops monitoring this guy
- lifecycles_.Unmonitor(object);
- DeallocateHandle(handle);
- return true; // Return a successful handle
- } else {
- // Return something more algebraic instead of null or an int.
- // It's kinda bad to not even report what went wrong.
- return false;
- };
- }
-} // namespace nt