diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2025-01-19 22:09:13 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2025-01-19 22:09:13 -0300 |
| commit | 355690f76f3ca895ade25d281beb1eea27e1f53e (patch) | |
| tree | 7d89760b95b79c5e45c4be94652dd2b65a1e6d89 /lib/disk.ml | |
| parent | 919b7f1a81982533ff4ab33730c68313690c2b77 (diff) | |
| download | Sakura-355690f76f3ca895ade25d281beb1eea27e1f53e.tar.gz Sakura-355690f76f3ca895ade25d281beb1eea27e1f53e.zip | |
add typing and schema
Diffstat (limited to 'lib/disk.ml')
| -rw-r--r-- | lib/disk.ml | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/disk.ml b/lib/disk.ml index d97a60c..b9f8155 100644 --- a/lib/disk.ml +++ b/lib/disk.ml @@ -92,12 +92,21 @@ module Executor = struct type history = t list [@@deriving show] end + type relational_type = + | Text + | Integer32 + | Integer64 + | Boolean + | DiscriminatedUnion of (string * relational_type option) list * string (* [("MemberA", None); ("MemberB", Some Integer32)], "NameOfDU" *) + + type schema = (string * relational_type) list StringMap.t type references = string list IntMap.t StringMap.t type commit = { state : string; files : Hashes.history StringMap.t; references : references; + schema : schema } type history = commit list @@ -127,7 +136,7 @@ module Executor = struct in Interop.Merkle.merkle_generate_root all_hashes - let write ({ files; references; _ } as commit : commit) + let write ({ files; references; schema; _ } as commit : commit) (locations : locations) ~filename ?hash_to_replace (content : Bytes.t) = let files = init_file files filename in let computed_hash : string = Interop.Sha256.compute_hash content in @@ -162,7 +171,7 @@ module Executor = struct locations in let commit = - { state = compose_new_state files; files; references } + { state = compose_new_state files; files; references; schema } in Ok ((commit, locations), Some computed_hash) | Some hash_to_replace -> @@ -195,7 +204,7 @@ module Executor = struct locations in let commit = - { state = compose_new_state files; files; references } + { state = compose_new_state files; files; references; schema } in Ok ((commit, locations), Some computed_hash)) | Some _ -> ( @@ -227,7 +236,7 @@ module Executor = struct in *) let files = StringMap.update filename update_fun files in let commit = - { state = compose_new_state files; files; references } + { state = compose_new_state files; files; references; schema } in (* let locations = StringMap.update computed_hash location_update_fun locations in *) Ok ((commit, locations), Some computed_hash) |
