aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/Scope.mli
blob: aabdc61c92c5c3e60956cdb48294db8c59c17a8d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
(** A branch state read from a home: a [Directory] of relations where
    [R] names the home schema's, [s:R] a schema's of the home multigroup,
    and [m:s:R] anyone's in the branch state. It lists the home schema. *)

type home = {multigroup: string; schema: string}

class type implementation = object
  (** the branch state read *)
  method branch : Protocols.Handle.t

  method home : home

  (** the same home in the state before, if there is one *)
  method previous : (Protocols.Handle.t option, Concepts.Condition.condition) result

  (** every relation of the branch state, as [m:s:R] *)
  method catalog : (string list, Concepts.Condition.condition) result
end

type Protocols.Handle.protocol += Scope of implementation

val make : Protocols.Handle.t -> home -> Protocols.Handle.t

(** [home] in the head of \system\branch\[branch]. *)
val of_root :
  Protocols.Handle.t ->
  branch:string ->
  home ->
  (Protocols.Handle.t, Concepts.Condition.condition) result

val require :
  Protocols.Handle.t ->
  (implementation Protocols.Handle.interface, Concepts.Condition.condition) result

val branch : implementation Protocols.Handle.interface -> Protocols.Handle.t
val home : implementation Protocols.Handle.interface -> home

val previous :
  implementation Protocols.Handle.interface ->
  (Protocols.Handle.t option, Concepts.Condition.condition) result

val catalog :
  implementation Protocols.Handle.interface -> (string list, Concepts.Condition.condition) result

(** \multigroup\[m]\schema\[s]\relation\[relation], from a branch state. *)
val path : home -> string -> Path.t

(** where [text] names a relation, read from [home], from a branch state. *)
val locate : home -> string -> Path.t option

(** the attribute [text] names of the relation named [relation], both read
    from [home]: bare, or qualified with a name of that relation. *)
val attribute : home -> string -> string -> string option

(** bind each named relation to its value, or unbind it on [None], in the
    head of \system\branch\[branch], as one successor state. A multigroup
    or schema not there yet is made, and a value with no address is
    stored as a schema stores it: a program as itself, a relation as its
    tuples. If the head moved meanwhile nothing changes, and it fails. *)
val publish :
  Protocols.Handle.t ->
  branch:string ->
  home:home ->
  (string * Protocols.Handle.t option) list ->
  (unit, Concepts.Condition.condition) result