aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEnrico Tassi2020-11-17 18:52:30 +0100
committerEnrico Tassi2021-01-27 09:45:48 +0100
commit1fd4c22d493715f154f6b79dc7f6e4efd44ff185 (patch)
tree6b0383f0fd01ce7218fe4782aac6bb7f3c79c64c /lib
parent0c185094d40d10dc43f1432ef708a329fae25751 (diff)
[ltac] break dependency on the STM
Diffstat (limited to 'lib')
-rw-r--r--lib/stateid.ml3
-rw-r--r--lib/stateid.mli7
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/stateid.ml b/lib/stateid.ml
index a1328f156c..2a41cb7866 100644
--- a/lib/stateid.ml
+++ b/lib/stateid.ml
@@ -45,3 +45,6 @@ type ('a,'b) request = {
name : string
}
+let is_valid_ref = ref (fun ~doc:_ (_ : t) -> true)
+let is_valid ~doc id = !is_valid_ref ~doc id
+let set_is_valid f = is_valid_ref := f
diff --git a/lib/stateid.mli b/lib/stateid.mli
index 9b2de9c894..4563710f84 100644
--- a/lib/stateid.mli
+++ b/lib/stateid.mli
@@ -42,3 +42,10 @@ type ('a,'b) request = {
name : string
}
+(* Asks the document manager is the given state is valid (or belongs to an
+ old version of the document) *)
+val is_valid : doc:int -> t -> bool
+
+(* By default [is_valid] always answers true, but a document manager supporting
+ undo operations like the STM can override this. *)
+val set_is_valid : (doc:int -> t -> bool) -> unit