Module B0_cli.File_cache

B0_zero.File_cache interaction.

High-level commands.

These commands act on a cache directory. They avoid to create it via B0_zero.File_cache.make if it doesn't exists and return Ok false in that case.

val keys_of_success_ops : B0_zero.Op.t list -> B0_std.String.Set.t

keys_of_success_ops ops are the non-nil hashes of the operations of ops that are B0_zero.Op.status.Success.

val delete : dir:B0_std.Fpath.t -> [ `All | `Keys of B0_zero.File_cache.key list ] -> (bool, string) Stdlib.result

delete dir keys deletes keys in dirs if an explicit key does not exist in dir a Log.warn is issued. If `All is specified dir is deleted and recreated.

val gc : dir:B0_std.Fpath.t -> used:B0_std.String.Set.t -> (bool, string) Stdlib.result

gc ~dir ~used deletes keys that are not in used.

val keys : dir:B0_std.Fpath.t -> (bool, string) Stdlib.result

keys dir lists the file cache keys on stdout.

val stats : dir:B0_std.Fpath.t -> used:B0_std.String.Set.t -> (bool, string) Stdlib.result

status ~dir ~used shows statistics about the file cache on stdout. used determines keys that are in use.

val trim : dir:B0_std.Fpath.t -> used:B0_std.String.Set.t -> max_byte_size:int -> pct:int -> (bool, string) Stdlib.result

trim dir ~used ~max_byte_size ~pct trims the cache using B0_zero.File_cache.trim_size. used determines keys that are assumed to be used.

Cli fragments

val key_arg : B0_zero.File_cache.key Cmdliner.Arg.conv

key_arg is an argument converter for cache keys.

val keys_none_is_all : ?pos_right:int -> unit -> [ `All | `Keys of B0_zero.File_cache.key list ] Cmdliner.Term.t

keys_none_is_all ~pos_right () are the keys at the right of position pos_right (defaults is all positional arguments). If none is specified this is `All.

val trim_cli : ?mb_opts:string list -> ?pct_opts:string list -> ?docs:string -> unit -> (int * int) Cmdliner.Term.t

trim_cli ~docs () are command line options to specify a maximal byte size and percentage to give to trim.