B0_memo_cli.File_cache
B0_zero.File_cache
interaction.
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.
type keyset = B0_std.String.Set.t
The type for sets of B0_zero.Filecache.key
.
val keys_of_success_ops : ?init:keyset -> B0_zero.Op.t list -> keyset
keys_of_success_ops ~init ops
adds to init
the non-nil hashes of the operations of ops
that are B0_zero.Op.status.Success
. init
defaults to String.Set.empty
.
val delete :
dir:B0_std.Fpath.t ->
used:keyset ->
kind:key_kind ->
[ `All | `Keys of B0_zero.File_cache.key list ] ->
(bool, string) Stdlib.result
delete ~dir ~used ~kind keys
deletes keys
in dir
if an explicit key does not exist in dir
or unused
(depending on kind
) a Log.warn
is issued. If `All
and `Any
is specified dir
is deleted and recreated.
val gc :
dry_run:bool ->
dir:B0_std.Fpath.t ->
used:keyset ->
(bool, string) Stdlib.result
gc ~dry_run ~dir ~used
deletes keys that are not in used
. If dry_run
is true
outputs deltions on stdout
rather than performing them.
val keys :
dir:B0_std.Fpath.t ->
used:keyset ->
kind:key_kind ->
(bool, string) Stdlib.result
keys ~dir ~used ~kind
lists the file cache keys on stdout
using keyed againt used
in the `Used
and `Unused
case. The argument is ignored on `All
.
val stats : dir:B0_std.Fpath.t -> used:keyset -> (bool, string) Stdlib.result
status ~dir ~used
outputs statistics about the file cache on stdout
. used
determines keys that are in use.
val trim :
dry_run:bool ->
dir:B0_std.Fpath.t ->
used:keyset ->
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. If dry_run
is true
outputs deletions on stdout
rather than performing them.
val dir :
?opts:string list ->
?docs:Cmdliner.Manpage.section_name ->
?doc:string ->
?doc_absent:string ->
?env:Cmdliner.Cmd.Env.info ->
unit ->
B0_std.Fpath.t option Cmdliner.Term.t
dir ~doc_none ~docs ~doc ~env
is a cli interface for specifying a file cache directory.
opts
are the cli options to specify it, default to ["b0-cache-dir"]
.docs
is where the option is documented, defaults to Cmdliner.Manpage.s_common_options
doc
is a doc string.doc_absent
describes how the value is determined if the term is evaluates to None
.env
is a variable that can be used to override the default value, defaults to dir_var
.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 :
?first:int ->
unit ->
[ `All | `Keys of B0_zero.File_cache.key list ] Cmdliner.Term.t
keys_none_is_all ~first ()
are the keys string at position first
(defaults is 0
). If none is specified this is `All
.
val trim_cli :
?mb_opts:string list ->
?pct_opts:string list ->
?docs:Cmdliner.Manpage.section_name ->
unit ->
(int * int) Cmdliner.Term.t
trim_cli ~docs ()
are options to specify a maximal byte size and percentage to give to trim
.
val key_kind_cli :
?docs:Cmdliner.Manpage.section_name ->
unit ->
key_kind Cmdliner.Term.t
key_kind_cli ()
are options to specify kinds of keys.