Crate bkt

source ·
Expand description

bkt (pronounced “bucket”) is a library for caching subprocess executions. It enables reuse of expensive invocations across separate processes and supports synchronous and asynchronous refreshing, TTLs, and other functionality. bkt is also a standalone binary for use by shell scripts and other languages, see https://github.com/dimo414/bkt for binary details.

let bkt = bkt::Bkt::in_tmp()?;
let expensive_cmd = bkt::CommandDesc::new(["wget", "https://example.com"]);
let (result, age) = bkt.retrieve(&expensive_cmd, Duration::from_secs(3600))?;
do_something(result.stdout_utf8());

Structs§

  • This struct is the main API entry point for the bkt library, allowing callers to invoke and cache subprocesses for later reuse.
  • A stateless description of a command to be executed and cached. It consists of a command line invocation and additional metadata about how the command should be cached which are configured via the with_* methods. Instances can be persisted and reused.
  • The stateful sibling of CommandDesc which represents a command to be executed and cached along with environment state (e.g. the current working directory) at the time the CommandState instance is constructed. It consists of a command line invocation and application state determining how the command should be cached and executed. Additional with_* methods are provided on this type for further modifying how the subprocess will be executed.
  • The outputs of a cached invocation of a CommandDesc, akin to std::process::Output.

Enums§

  • Holds information about the cache status of a given command.