diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/core_functions.ml | 2 | ||||
| -rw-r--r-- | lib/disk.ml | 9 | ||||
| -rw-r--r-- | lib/interop.ml | 3 |
3 files changed, 5 insertions, 9 deletions
diff --git a/lib/core_functions.ml b/lib/core_functions.ml index 3d1cd35..7fdf1f1 100644 --- a/lib/core_functions.ml +++ b/lib/core_functions.ml @@ -20,6 +20,4 @@ module Functions (F : Ctypes.FOREIGN) = struct ~filename:((Sys.getenv "LIBRELATIONAL_ENGINE_LIB_PATH") ^ "/librelational_engine." ^ os_extension) let compute_hash = Foreign.foreign ~from:libmerklecpp "compute_hash" (ptr char @-> Ctypes.string @-> returning void) let merkle_generate_root = Foreign.foreign ~from:libmerklecpp "merkle_generate_root" (ptr Ctypes.string @-> int @-> ptr char @-> returning void) - let register_to_merkle = Foreign.foreign ~from:libmerklecpp "register_to_merkle" (Ctypes.string @-> Ctypes.string @-> returning void) - end diff --git a/lib/disk.ml b/lib/disk.ml index aa971dd..fc99607 100644 --- a/lib/disk.ml +++ b/lib/disk.ml @@ -191,12 +191,13 @@ module Command = struct (** TODO: This does not write atomically. If the system crashes while it attempts to write, it will corrupt. Solve this with a temporary file and move later. *) - let commit - (* (_files: Filesystem.files) (_locations: Filesystem.locations) *) - command = + let commit_and_perform (commit: Executor.commit) (locations: Executor.locations) command = let open Extensions.Result in let+ serialized_command = Result.map_error (fun _ -> "Failed to serialize command to binary format.") @@ Binary.to_bytes command_encoding command in - FS.append FS.Transaction serialized_command + let+ _ = FS.append FS.Transaction serialized_command in + match command.kind with + | WRITE -> Executor.write commit locations ~filename:command.filename @@ Bytes.of_string command.content + | _ -> Ok (commit, locations) end diff --git a/lib/interop.ml b/lib/interop.ml index 28b4fb9..fdfde5f 100644 --- a/lib/interop.ml +++ b/lib/interop.ml @@ -16,7 +16,4 @@ module Merkle = struct let hashes = CArray.of_list string hashes in C.Functions.merkle_generate_root (CArray.start hashes) len buf; Ctypes.coerce (ptr char) Ctypes.string buf - - let register_to_merkle content = - C.Functions.register_to_merkle "/tmp/relational-engine/tree" content end |
