summaryrefslogtreecommitdiffhomepage
path: root/StorageKit/StorageCore.inl
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
commit5339d016c07bf717ee388f4feb73544087324af0 (patch)
tree94be6f67ed626091f24aee24ec3b3be03d01e4e7 /StorageKit/StorageCore.inl
git: port from mercurial repo.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'StorageKit/StorageCore.inl')
-rw-r--r--StorageKit/StorageCore.inl56
1 files changed, 56 insertions, 0 deletions
diff --git a/StorageKit/StorageCore.inl b/StorageKit/StorageCore.inl
new file mode 100644
index 00000000..f0891880
--- /dev/null
+++ b/StorageKit/StorageCore.inl
@@ -0,0 +1,56 @@
+/*
+ * ========================================================
+ *
+ * hCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#ifndef __STORAGEKIT_STORAGECORE_INL__
+#define __STORAGEKIT_STORAGECORE_INL__
+
+#include <NewKit/Defines.hpp>
+
+// @brief Storage management unit.
+// swap files, files, dirs optimization.
+
+namespace hCore
+{
+ typedef Char* SKStr;
+
+ //! @brief Storage context, reads and write file according to the descriptor layout.
+ class StorageContext
+ {
+ public:
+ explicit StorageContext() = default;
+ ~StorageContext() = default;
+
+ StorageContext& operator=(const StorageContext&) = default;
+ StorageContext(const StorageContext&) = default;
+
+ public:
+ bool Write(VoidPtr fileDescriptor, SizeT sizeFileDescriptor);
+
+ struct SDescriptor
+ {
+ VoidPtr fFilePtr;
+ SizeT fFilePtrSz;
+ };
+
+ SDescriptor Read(const SKStr name);
+
+ };
+
+#define kMaxPathSK 4096
+
+ struct StorageLayout final
+ {
+ Char fName[kMaxPathSK];
+ VoidPtr fData;
+ SizeT fDataSz;
+ Int32 fType;
+ };
+}
+
+#endif /* ifndef __STORAGEKIT_STORAGECORE_INL__ */