aboutsummaryrefslogtreecommitdiffstats
path: root/lib/scl
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-05-18 12:35:26 -0300
committerGitHub <noreply@github.com>2026-05-18 12:35:26 -0300
commitcf0fffed43d0ca7618cd0013411151e057b7a32a (patch)
tree35915aee3f7160b9ff6b41c3c0502b34050f642c /lib/scl
parente3d3e20dfea253de291d5b31059cd55c0eaabf02 (diff)
downloadSakura-cf0fffed43d0ca7618cd0013411151e057b7a32a.tar.gz
Sakura-cf0fffed43d0ca7618cd0013411151e057b7a32a.zip
RNT interface
Co-authored-by: Estevan Castilho <tevo@riajuu.net>
Diffstat (limited to '')
-rw-r--r--lib/scl/executor.ml17
-rw-r--r--lib/scl/sublanguage.ml17
2 files changed, 16 insertions, 18 deletions
diff --git a/lib/scl/executor.ml b/lib/scl/executor.ml
index 7532eaa..6848091 100644
--- a/lib/scl/executor.ml
+++ b/lib/scl/executor.ml
@@ -6,11 +6,12 @@ type cursor_batch = {
has_more : bool;
}
-type exec_result = Batch of cursor_batch | Closed of Management.Multigroup.multigroup
+type exec_result =
+ | Batch of cursor_batch
+ | Closed of Sublanguage_types.transition_delta
-module Make (Storage : Management.Physical.S) = struct
- module DrlExec = Drl.Executor.Make (Storage)
- module Alg = Algebra.Make (Storage)
+module Make (NT : Nt.S) = struct
+ module DrlExec = Drl.Executor.Make (NT)
type error =
| ParseError of string
@@ -26,8 +27,8 @@ module Make (Storage : Management.Physical.S) = struct
let ( let* ) = Result.bind
- let execute (_storage : Storage.t) (db : Management.Multigroup.multigroup)
- (stmt : Ast.statement) : (exec_result, error) result =
+ let execute (ctx : Sublanguage_context.t) (stmt : Ast.statement) :
+ (exec_result, error) result =
ignore default_batch;
match stmt with
| Ast.Begin _ ->
@@ -36,7 +37,7 @@ module Make (Storage : Management.Physical.S) = struct
Error (CursorError "cursors not yet implemented")
| Ast.Close _ ->
let* () = Ok () in
- Ok (Closed db)
+ Ok (Closed ctx.branch#multigroups)
end
-module Memory = Make (Management.Physical.Memory)
+module Memory = Make (Nt.Memory)
diff --git a/lib/scl/sublanguage.ml b/lib/scl/sublanguage.ml
index 722ba08..87e4d42 100644
--- a/lib/scl/sublanguage.ml
+++ b/lib/scl/sublanguage.ml
@@ -1,8 +1,7 @@
-module Make (Storage : Management.Physical.S) = struct
- module Exec = Executor.Make (Storage)
+module Make (NT : Nt.S) = struct
+ module Exec = Executor.Make (NT)
type configuration = unit
- type storage = Storage.t
type ast = Ast.statement
type error = Exec.error
@@ -14,14 +13,12 @@ module Make (Storage : Management.Physical.S) = struct
| Ok r -> Ok r
| Error (Parser.ParseError s) -> Error (Exec.ParseError s)
- let execute storage db ast =
- Exec.execute storage db ast
+ let execute ctx ast =
+ Exec.execute ctx ast
|> Result.map (function
- | Executor.Batch { cursor_id; rows; has_more } ->
- Sublanguage_types.Cursor { cursor_id; rows; has_more }
- | Executor.Closed db -> Sublanguage_types.Transition db)
+ | Executor.Batch { cursor_id; rows; has_more } ->
+ Sublanguage_types.Cursor { cursor_id; rows; has_more }
+ | Executor.Closed delta -> Sublanguage_types.Transition delta)
let sexp_of_error = Exec.sexp_of_error
end
-
-module Memory = Make (Management.Physical.Memory)