aboutsummaryrefslogtreecommitdiffstats
path: root/lib/concepts/Representation.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/Representation.ml
parentb242516fc820a0a1ab00e24151a5b978f9a6f4a3 (diff)
downloadRNT-db968eccee931abc8ad00d74d152625a2ab3174e.tar.gz
RNT-db968eccee931abc8ad00d74d152625a2ab3174e.zip
Tidy up
Diffstat (limited to '')
-rw-r--r--lib/concepts/Representation.ml36
-rw-r--r--lib/concepts/Representation.mli16
2 files changed, 0 insertions, 52 deletions
diff --git a/lib/concepts/Representation.ml b/lib/concepts/Representation.ml
deleted file mode 100644
index 12c3624..0000000
--- a/lib/concepts/Representation.ml
+++ /dev/null
@@ -1,36 +0,0 @@
-(* @needs Value *)
-
-type blob = bytes
-
-let blob_of_bytes (b : bytes) = b
-let bytes_of_blob (b : blob) = b
-
-(* A blob is a one-byte constructor tag followed by its payload. The
- tag makes the encoding self-describing so [value_of_blob] can
- recover the constructor:
- - String ['\000'] ++ raw utf-8 bytes
- - Integer ['\001'] ++ 8-byte big-endian int64 *)
-let tag_string = '\000'
-let tag_integer = '\001'
-
-let blob_of_value = function
- | Value.String s ->
- let b = Bytes.create (1 + String.length s) in
- Bytes.set b 0 tag_string;
- Bytes.blit_string s 0 b 1 (String.length s);
- b
- | Value.Integer n ->
- let b = Bytes.create 9 in
- Bytes.set b 0 tag_integer;
- Bytes.set_int64_be b 1 (Int64.of_int n);
- b
-
-let value_of_blob (b : blob) =
- let n = Bytes.length b in
- if n = 0 then invalid_arg "value_of_blob: empty blob";
- match Bytes.get b 0 with
- | c when c = tag_string -> Value.String (Bytes.sub_string b 1 (n - 1))
- | c when c = tag_integer ->
- if n <> 9 then invalid_arg "value_of_blob: malformed integer payload";
- Value.Integer (Int64.to_int (Bytes.get_int64_be b 1))
- | c -> invalid_arg (Printf.sprintf "value_of_blob: unknown tag %C" c)
diff --git a/lib/concepts/Representation.mli b/lib/concepts/Representation.mli
deleted file mode 100644
index 21c43a4..0000000
--- a/lib/concepts/Representation.mli
+++ /dev/null
@@ -1,16 +0,0 @@
-(** 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
-
-(* TODO: see the comments on Backend.Storage.LMDB *)
-
-(** create a blob from the data represented by bytes *)
-val blob_of_bytes : bytes -> blob
-
-(** return a bytes containing the data underlying a blob *)
-val bytes_of_blob : blob -> bytes