aboutsummaryrefslogtreecommitdiffstats
path: root/lib/concepts/Blob.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-08-22 17:55:26 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-08-23 03:06:58 +0000
commitdb968eccee931abc8ad00d74d152625a2ab3174e (patch)
tree3d5018dd9e298cfc1fb14bf404cde3fce5953fca /lib/concepts/Blob.ml
parentb242516fc820a0a1ab00e24151a5b978f9a6f4a3 (diff)
downloadRNT-db968eccee931abc8ad00d74d152625a2ab3174e.tar.gz
RNT-db968eccee931abc8ad00d74d152625a2ab3174e.zip
Tidy up
Diffstat (limited to '')
-rw-r--r--lib/concepts/Blob.ml17
-rw-r--r--lib/concepts/Blob.mli26
2 files changed, 43 insertions, 0 deletions
diff --git a/lib/concepts/Blob.ml b/lib/concepts/Blob.ml
new file mode 100644
index 0000000..c5d7d5c
--- /dev/null
+++ b/lib/concepts/Blob.ml
@@ -0,0 +1,17 @@
+(* @needs Value *)
+
+(* The intent of this being an abstract type is to allow for switching
+ the implementation to one backed by a C array later on, which would
+ let us avoid copying when passing it through FFI boundaries. *)
+type t = bytes
+
+let blob_of_bytes (b : bytes) = b
+let bytes_of_blob (b : t) = b
+let create = Bytes.create
+let set = Bytes.set
+let set_int64_be = Bytes.set_int64_be
+let blit_string = Bytes.blit_string
+let length = Bytes.length
+let get = Bytes.get
+let sub_string = Bytes.sub_string
+let get_int64_be = Bytes.get_int64_be
diff --git a/lib/concepts/Blob.mli b/lib/concepts/Blob.mli
new file mode 100644
index 0000000..b7c5da3
--- /dev/null
+++ b/lib/concepts/Blob.mli
@@ -0,0 +1,26 @@
+(** an abstract representation of an encoded value *)
+type t
+
+(* TODO: see the comments on Backend.Storage.LMDB *)
+
+(** create a blob from the data represented by bytes *)
+val blob_of_bytes : bytes -> t
+
+(** return a bytes containing the data underlying a blob *)
+val bytes_of_blob : t -> bytes
+
+val create : int -> t
+
+val set : t -> int -> char -> unit
+
+val set_int64_be : t -> int -> int64 -> unit
+
+val blit_string : string -> int -> t -> int -> int -> unit
+
+val length : t -> int
+
+val get : t -> int -> char
+
+val sub_string : t -> int -> int -> string
+
+val get_int64_be : t -> int -> int64