Module Superbol_cache.Witness

Building witnesses.

Whether two paths differing only in case denote one file is a property of the host rather than of any one cache, so it is settled once for the process. It defaults to what the system name implies and is corrected by whoever creates a concrete store, which is the only place the actual file-system is known --- macOS is case-insensitive by default but need not be, and a Linux host may have a share mounted that is not.

val set_case_insensitive : bool -> unit

set_case_insensitive b declares whether the host tells two paths differing only in case apart. Call it before anything is cached; changing it later invalidates every witness recorded so far, which costs misses rather than wrong hits.

val case_insensitive : unit -> bool

case_insensitive () is what set_case_insensitive last established.

val canonical_path : string -> string

canonical_path name is how name is spelled in a witness.

val file : name:string -> contents:string -> Types.witness

file ~name ~contents witnesses that the file name was read and held contents.

val dir : name:string -> entries:string list -> Types.witness

dir ~name ~entries witnesses that the directory name was searched and held exactly entries.

This is what keeps a copybook lookup honest: resolving a copybook in one directory of a search path asserts that the directories before it held no candidate, so a copybook added to one of them must be a miss even though no file that was read has changed.

val env : var:string -> value:string option -> Types.witness

env ~var ~value witnesses that var was consulted and found unset (None) or set to a given value.

sub key witnesses that the entry key was reused.