From b2b1d9a3a8cbf2f5d0089e29931cacf36297065a Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Fri, 6 Mar 2026 20:27:49 -0300 Subject: wip: physical --- lib/core_functions.ml | 3 --- lib/management/database.ml | 23 +++++++++++++++++++++++ lib/management/physical.ml | 12 ++++++++++++ lib/prelude/standard.ml | 6 +----- 4 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 lib/management/database.ml create mode 100644 lib/management/physical.ml (limited to 'lib') diff --git a/lib/core_functions.ml b/lib/core_functions.ml index 059cd14..39094cc 100644 --- a/lib/core_functions.ml +++ b/lib/core_functions.ml @@ -1,9 +1,6 @@ -(* open Ctypes *) - module Types = Types_generated module Functions (F : Ctypes.FOREIGN) = struct - (* open F *) open Ctypes_static let os_extension = diff --git a/lib/management/database.ml b/lib/management/database.ml new file mode 100644 index 0000000..4fd43f1 --- /dev/null +++ b/lib/management/database.ml @@ -0,0 +1,23 @@ +module RelationMap = Map.Make (String) + +type t = { + hash : Conventions.Hash.t; + name : Conventions.Name.t; + tree : unit; + relations : Relation.t RelationMap.t; + timestamp : float; +} + +let create_database (storage: Physical.Storage.t) ~name = + let relations = + RelationMap.of_list [("less_than", Prelude.Standard.less_than_natural)] + in + let state = + { + hash = ""; + name; + tree = (); + relations = relations; + timestamp = Unix.time (); + } + in Physical.Storage.write storage diff --git a/lib/management/physical.ml b/lib/management/physical.ml new file mode 100644 index 0000000..83ccbcc --- /dev/null +++ b/lib/management/physical.ml @@ -0,0 +1,12 @@ +module type STORAGE = sig + type t + val write: t -> Conventions.Hash.t + +end + +module Storage: STORAGE = struct + type t + let write _ = + failwith "TODO" + +end \ No newline at end of file diff --git a/lib/prelude/standard.ml b/lib/prelude/standard.ml index d6f8cf3..5099104 100644 --- a/lib/prelude/standard.ml +++ b/lib/prelude/standard.ml @@ -11,12 +11,8 @@ let less_than_natural: Relation.t = match position with | Some position -> let left, right = pair_of_nat position in - (* let left: Attribute.t = Attribute.make_materialized ~value: (Obj.magic left) in *) - (* let right: Attribute.t = Attribute.make_materialized ~value: (Obj.magic right) in *) - let left = Obj.magic left in - let right = Obj.magic right in let attributes: Attribute.materialized Tuple.AttributeMap.t = - Tuple.AttributeMap.of_list [("left", left); ("right", right)] + Tuple.AttributeMap.of_list [("left", Obj.magic left); ("right", Obj.magic right)] in Generator.Value (Tuple.make_materialized ~relation: "less_than" ~attributes: attributes, generator) | None -> Error "Cannot produce a randomly enumerated value for less_than over naturals." in let membership_criteria: Tuple.t -> bool = function -- cgit v1.2.3