package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/b0.memo/B0_memo_cli/File_cache/index.html
Module B0_memo_cli.File_cacheSource
B0_zero.File_cache interaction.
High-level commands implementations
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.
The type for sets of B0_zero.Filecache.key.
The type for key kinds.
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) resultdelete ~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.
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.
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.
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) resulttrim 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.
Cli fragments
File cache directoy
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.tdir ~doc_none ~docs ~doc ~env is a cli interface for specifying a file cache directory.
optsare the cli options to specify it, default to["b0-cache-dir"].docsis where the option is documented, defaults toCmdliner.Manpage.s_common_optionsdocis a doc string.doc_absentdescribes how the value is determined if the term is evaluates toNone.envis a variable that can be used to override the default value, defaults todir_var.
b0_dir_env is "B0_CACHE_DIR".
dirname is ".cache", a sugggested cache directory name.
File cache operations
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.tkeys_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.ttrim_cli ~docs () are options to specify a maximal byte size and percentage to give to trim.
key_kind_cli () are options to specify kinds of keys.