Skip to main content

Crate qk_cache

Crate qk_cache 

Source
Expand description

Local content-addressed cache shared by linked Git worktrees.

Modules§

profile
Opt-in elapsed timings for cache operations, written to stderr.
warm
Warm state: scratch state a task runs faster with, kept between runs of the same task and restored before it runs, but never part of a result. A target opts in with qk:warm:

Structs§

Cache
The cache for one run; its workspace snapshot is taken on first use.
Execution
One actual keyed execution, independent of reusable cache entries.
InputChanges
Matches one revision change set against any number of resolved tasks, sharing linked-path traversal across tasks. Env and runtime values are not evaluated; the caller supplies lockfile revisions and the workspace-file comparison.
Outputs
Pattern
Pruned
Resolution
Every task’s resolved inputs, or why they could not be resolved, with the workspace files they were chosen from.
Resolved
A task’s selected file and non-file inputs, before cache-key evaluation.
SourceIgnore
Compiled root ignore rules used by input discovery and project watching.
TaskResult

Enums§

CacheStatus
Where a task’s result came from.
InputChange
A changed input’s meaning, independent of revision loading and task reports.

Functions§

cache_directory
The cache’s default place, in the repository’s common git directory.
cache_location
Where the cache is: as in Nx, NX_CACHE_DIRECTORY, then nx.json cacheDirectory, relative to the workspace root, with qk’s entries in qk/v1 inside so they never mix with Nx’s; otherwise cache_directory, shared by the repository’s worktrees.
clear_worktree_state
Removes a worktree’s state: its file digests, the outputs it records holding, its warm directories and any restores or sandboxes left behind.
expand_project_path
Expands {projectRoot} and {workspaceRoot} in a project’s path or glob.
keys
The key each task in graph would be cached under if it ran now, and what it is computed from, without running a task. Runtime inputs are executed. A dependency counts as having succeeded, fingerprinted by its outputs as they are on disk.
manifest_for_dependents
A dependency’s package.json as its dependents’ keys read it: without fields that cannot change what they read or run, and, when the lockfile records the installs, without the declarations it resolved. None when it cannot be read as a JSON object.
max_size
The size limit: NX_MAX_CACHE_SIZE, then nx.json maxCacheSize, then, as in Nx, a tenth of the disk holding the cache. None when the limit is 0, which means unlimited.
parse_size
Nx’s parseMaxCacheSize: a number of bytes with an optional KB, MB or GB unit, in powers of 1024.
prune
Evicts least recently used entries until the cache holds at most limit bytes, and removes what no entry needs. Another prune in progress makes this one return without doing anything.
prune_automatic
Enforces the limit after a run, reusing size accounting while the cache’s directories are unchanged. Normal publication replaces records atomically and blobs are immutable, so directory changes invalidate the memo. A full reconciliation still runs at least once an hour.
resolve_each
resolve_tasks
Each task’s resolved inputs, for affected selection. extra paths are candidates beside the workspace’s files, so a deleted file still matches the inputs that named it. Env and runtime inputs are not evaluated.
resolved_outputs
A task’s outputs as Nx lists them: workspace-relative paths and globs, ! for a negated one, with {options.name}, {projectName} and the project tokens replaced; an output naming what has no value is left out. Without outputs, Nx’s defaults: options.outputPath, and for build and prepare targets dist/<root>, <root>/dist, <root>/build and <root>/public. The flag tells whether the target declared them.
source_files
Source files visible to Nx, with runner state and root ignore rules removed.
without_resolution
A pnpm-workspace.yaml text without its resolution keys.
worktree_state
Where qk keeps what belongs to one worktree: digests of its files, records of the outputs it holds, and restores in progress. Inside Git that is the worktree’s own git directory, so nothing appears in the working tree; outside Git it is .qk at the workspace root.

Type Aliases§

Fingerprint
A task’s output fingerprint for its dependents’ keys, or why it has none: "<task id>: <reason>" for the task where fingerprinting first failed.
Keyed
A task’s key, and the inputs it is computed from, or why it has none.