package b0

  1. Overview
  2. Docs
Software construction and deployment kit

Install

dune-project
 Dependency

Authors

Maintainers

Sources

b0-0.0.6.tbz
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.

Sourcetype key_kind = [
  1. | `Any
  2. | `Used
  3. | `Unused
]

The type for key kinds.

Sourceval 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.

Sourceval delete : dir:B0_std.Fpath.t -> used:keyset -> kind:key_kind -> [ `All | `Keys of B0_zero.File_cache.key list ] -> (bool, string) 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.

Sourceval gc : dry_run:bool -> dir:B0_std.Fpath.t -> used:keyset -> (bool, string) 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.

Sourceval keys : dir:B0_std.Fpath.t -> used:keyset -> kind:key_kind -> (bool, string) 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.

Sourceval stats : dir:B0_std.Fpath.t -> used:keyset -> (bool, string) result

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

Sourceval trim : dry_run:bool -> dir:B0_std.Fpath.t -> used:keyset -> max_byte_size:int -> pct:int -> (bool, string) 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.

Cli fragments

File cache directoy

Sourceval 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.

b0_dir_env is "B0_CACHE_DIR".

Sourceval dirname : string

dirname is ".cache", a sugggested cache directory name.

File cache operations

key_arg is an argument converter for cache keys.

Sourceval 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.

Sourceval 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.

key_kind_cli () are options to specify kinds of keys.

Sourceval dry_run : ?docs:Cmdliner.Manpage.section_name -> unit -> bool Cmdliner.Term.t

dry_run () is a --dry-run option of trim and gc.