diff options
| author | coqbot-app[bot] | 2021-01-27 14:29:48 +0000 |
|---|---|---|
| committer | GitHub | 2021-01-27 14:29:48 +0000 |
| commit | 8d697d8a4fe7165b736736196b167c5dc4725583 (patch) | |
| tree | 254e8f190cb63b00f2b1f448b6c6844342bbfe2f /lib | |
| parent | 0c185094d40d10dc43f1432ef708a329fae25751 (diff) | |
| parent | 4d6c244ca6003991d6a3932461c5b1034e32b8f4 (diff) | |
Merge PR #13418: [sysinit] new component
Reviewed-by: SkySkimmer
Reviewed-by: Zimmi48
Ack-by: JasonGross
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/stateid.ml | 3 | ||||
| -rw-r--r-- | lib/stateid.mli | 7 |
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..00acc962a2 100644 --- a/lib/stateid.mli +++ b/lib/stateid.mli @@ -42,3 +42,10 @@ type ('a,'b) request = { name : string } +(* Asks the document manager if 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 |
