diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-05-18 12:35:26 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-18 12:35:26 -0300 |
| commit | cf0fffed43d0ca7618cd0013411151e057b7a32a (patch) | |
| tree | 35915aee3f7160b9ff6b41c3c0502b34050f642c /lib/sublanguage_context.ml | |
| parent | e3d3e20dfea253de291d5b31059cd55c0eaabf02 (diff) | |
| download | Sakura-cf0fffed43d0ca7618cd0013411151e057b7a32a.tar.gz Sakura-cf0fffed43d0ca7618cd0013411151e057b7a32a.zip | |
RNT interface
Co-authored-by: Estevan Castilho <tevo@riajuu.net>
Diffstat (limited to 'lib/sublanguage_context.ml')
| -rw-r--r-- | lib/sublanguage_context.ml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/sublanguage_context.ml b/lib/sublanguage_context.ml new file mode 100644 index 0000000..c7598f1 --- /dev/null +++ b/lib/sublanguage_context.ml @@ -0,0 +1,39 @@ +(** Execution context passed to every sublanguage. + + - [write_handle] NT branch handle; sublanguages use it for mutations + (create_relation, link_tuple, etc). Read-only + sublanguages (DRL) ignore it. + + - [branch] Structural view over the active branch — gives every + executor random-access to every multigroup bound to + the branch via [mg_of]. Schema lookups for an FQN + [{mg; name}] use [branch#mg_of mg |> Option.bind + (fun m -> m#get_relation name)]. + + - [resolve] Builds an absolute RNT path for an FQN. Pass + [~branch:b] to address a relation on a different + live branch (cross-multigroup reads). + + - [switch_branch] Closes the current branch and opens the named one, + returning the delta describing the new branch's mg + set. Provided by the listener so VCL does not need + direct access to session state. *) + +type branch_view = < + name : string; + tip : string; + mg_of : string -> Management.Multigroup.multigroup option; + multigroups : (string * Management.Multigroup.multigroup) list; + add_multigroup : name:string -> unit; + set_mg : name:string -> + Management.Multigroup.multigroup -> unit; + path : ?branch:string -> Qualified_name.t -> string; +> + +type t = { + write_handle : Nt.branch_handle; + branch : branch_view; + resolve : ?branch:string -> Qualified_name.t -> string; + switch_branch : string -> + (Sublanguage_types.transition_delta, Nt.error) result; +} |
