aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-07-09 00:33:37 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-07-09 00:33:37 +0000
commit2566cfae03199f8e90098c84b712d48182d9b806 (patch)
tree4209d319e67f0f055e5055bc67a022bfdb3dd43f
parent5a799734ddd523027a7d6ef8b0acab6d0b796ec6 (diff)
downloadRNT-2566cfae03199f8e90098c84b712d48182d9b806.tar.gz
RNT-2566cfae03199f8e90098c84b712d48182d9b806.zip
Interface for the storage layer
-rw-r--r--lib/abstract/Storage.ml18
-rw-r--r--lib/backend/storage/LMDB.ml11
-rw-r--r--lib/backend/storage/LMDB.mli1
-rw-r--r--lib/concepts/Configuration.ml1
-rw-r--r--lib/concepts/Configuration.mli2
-rw-r--r--lib/concepts/Hash.ml5
-rw-r--r--lib/concepts/Hash.mli8
-rw-r--r--lib/concepts/Representation.ml5
-rw-r--r--lib/concepts/Representation.mli7
-rw-r--r--lib/concepts/Value.ml3
-rw-r--r--lib/concepts/Value.mli4
11 files changed, 65 insertions, 0 deletions
diff --git a/lib/abstract/Storage.ml b/lib/abstract/Storage.ml
new file mode 100644
index 0000000..d0f2097
--- /dev/null
+++ b/lib/abstract/Storage.ml
@@ -0,0 +1,18 @@
+module type STORAGE = sig
+ type connection
+ type transaction
+
+ val connect: Concepts.Configuration.configuration -> connection
+
+ (** begin a transaction within `connection` *)
+ val start: connection -> transaction
+ (** `commit` the current transaction *)
+ val commit: transaction -> ()
+ (** `abort` the current transaction *)
+ val abort: transaction -> ()
+
+ (** within a transaction, fetch a blob from disk *)
+ val get: transaction -> Concepts.Hash.hash -> Concepts.Representation.blob
+ (** within a transaction, associate a hash with a blob on disk *)
+ val put: transaction -> Concepts.Hash.hash -> Concepts.Representation.blob -> ()
+end
diff --git a/lib/backend/storage/LMDB.ml b/lib/backend/storage/LMDB.ml
new file mode 100644
index 0000000..3478da2
--- /dev/null
+++ b/lib/backend/storage/LMDB.ml
@@ -0,0 +1,11 @@
+type connection = unit
+type transaction = unit
+
+let connect (_: Concepts.Configuration.configuration) = failwith "TODO"
+
+let start (_: connection) = failwith "TODO"
+let commit (_: transaction) = failwith "TODO"
+let abort (_: transaction) = failwith "TODO"
+
+let get (_: transaction) (_: Concepts.Hash.hash) = failwith "TODO"
+let put (_: transaction) (_: Concepts.Hash.hash) (_: Concepts.Representation.blob) = failwith "TODO"
diff --git a/lib/backend/storage/LMDB.mli b/lib/backend/storage/LMDB.mli
new file mode 100644
index 0000000..dde4b6e
--- /dev/null
+++ b/lib/backend/storage/LMDB.mli
@@ -0,0 +1 @@
+include Abstract.Storage
diff --git a/lib/concepts/Configuration.ml b/lib/concepts/Configuration.ml
new file mode 100644
index 0000000..06434c2
--- /dev/null
+++ b/lib/concepts/Configuration.ml
@@ -0,0 +1 @@
+type configuration = unit
diff --git a/lib/concepts/Configuration.mli b/lib/concepts/Configuration.mli
new file mode 100644
index 0000000..5e16ff9
--- /dev/null
+++ b/lib/concepts/Configuration.mli
@@ -0,0 +1,2 @@
+(** an abstract representation for a system configuration *)
+type configuration
diff --git a/lib/concepts/Hash.ml b/lib/concepts/Hash.ml
new file mode 100644
index 0000000..4c6cd8a
--- /dev/null
+++ b/lib/concepts/Hash.ml
@@ -0,0 +1,5 @@
+type hash = ()
+
+val hash_of_value (_: Value.value) = failwith "TODO"
+
+val hash_equals (_: hash) (_: hash) = failwith "TODO"
diff --git a/lib/concepts/Hash.mli b/lib/concepts/Hash.mli
new file mode 100644
index 0000000..dc25669
--- /dev/null
+++ b/lib/concepts/Hash.mli
@@ -0,0 +1,8 @@
+(** An abstract value representing a hash *)
+type hash
+
+(** Given a value, compute it's hash *)
+val hash_of_value: Value.value -> hash
+
+(** Given two hashes, are they the same? *)
+val hash_equals: hash -> hash -> bool
diff --git a/lib/concepts/Representation.ml b/lib/concepts/Representation.ml
new file mode 100644
index 0000000..4df7812
--- /dev/null
+++ b/lib/concepts/Representation.ml
@@ -0,0 +1,5 @@
+type blob = unit
+
+let blob_of_value (_: Value.value) = failwith "TODO"
+
+let value_of_blob (_: blob) = failwith "TODO"
diff --git a/lib/concepts/Representation.mli b/lib/concepts/Representation.mli
new file mode 100644
index 0000000..9d0a8f5
--- /dev/null
+++ b/lib/concepts/Representation.mli
@@ -0,0 +1,7 @@
+(** an abstract representation of an encoded value *)
+type blob
+
+(** encode a blob into a value *)
+val blob_of_value: Value.value -> blob
+(** decode a value from a blob *)
+val value_of_blob: blob -> Value.value
diff --git a/lib/concepts/Value.ml b/lib/concepts/Value.ml
new file mode 100644
index 0000000..3e57717
--- /dev/null
+++ b/lib/concepts/Value.ml
@@ -0,0 +1,3 @@
+type value
+ = String of string
+ | Integer of int
diff --git a/lib/concepts/Value.mli b/lib/concepts/Value.mli
new file mode 100644
index 0000000..6cb09ad
--- /dev/null
+++ b/lib/concepts/Value.mli
@@ -0,0 +1,4 @@
+(** A tagged concrete value *)
+type value
+ = String of string
+ | Integer of int