Stores and restores cached outputs for declared Bau tasks.
Types
TaskCacheEntry = object key*: string ## Deterministic cache key for the task invocation. taskName*: string ## Task name associated with the cache entry. path*: string ## Local filesystem path for the cache entry. outputs*: seq[string] ## Output patterns allowed to be restored.
- Address of cached outputs for one task key.
TaskCacheExplain = object task*: string ## Task name being explained. key*: string ## Computed cache key. path*: string ## Local cache entry path. localHit*: bool ## True when a matching local entry exists. remoteHit*: bool ## True when a matching remote entry exists. remoteError*: string ## Remote lookup error, if any. keyInputs*: seq[string] ## Inputs that contributed to the cache key. outputs*: seq[string] ## Output patterns declared by the task.
- Diagnostic data for a task cache lookup.
Procs
proc cacheEntryExists(entry: TaskCacheEntry): bool {....raises: [], tags: [ReadDirEffect], forbids: [].}
- Return true when a local cache entry manifest exists.
proc cleanTaskCache(projectDir: string; cfg: BauConfig) {....raises: [OSError], tags: [ReadDirEffect, WriteDirEffect], forbids: [].}
- Remove all local task-cache entries for a project.
proc explainTaskCache(task: TaskInfo; projectDir: string; cfg: BauConfig; profile: string; selection: FeatureSelection = FeatureSelection()): TaskCacheExplain {....raises: [ KeyError, OSError, ValueError, IOError, Exception, LibraryError, OSError, SslError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect, ReadIOEffect, WriteIOEffect, TimeEffect], forbids: [].}
- Compute cache diagnostics for a task without restoring outputs.
proc listTaskCacheEntries(projectDir: string; cfg: BauConfig): seq[string] {. ...raises: [OSError, ValueError], tags: [ReadDirEffect, RootEffect], forbids: [].}
- List local task-cache entry paths relative to the cache tasks root.
proc restoreRemoteTaskOutputs(entry: TaskCacheEntry; projectDir: string; cfg: BauConfig; remoteError: var string): bool {. ...raises: [Exception], tags: [RootEffect, ReadIOEffect, WriteIOEffect, TimeEffect, ReadDirEffect, WriteDirEffect], forbids: [].}
-
Restore task outputs from the configured remote cache.
Returns false on miss or remote error and writes the error message to remoteError.
proc restoreTaskOutputs(entry: TaskCacheEntry; projectDir: string): bool {....raises: [ OSError, IOError, IOError, OSError, JsonParsingError, ValueError, KeyError, ValueError, OSError, IOError, Exception], tags: [WriteDirEffect, ReadDirEffect, TimeEffect, WriteIOEffect, ReadIOEffect, RootEffect], forbids: [].}
-
Restore declared task outputs from a local cache entry.
Returns false when the entry is missing.
proc saveRemoteTaskOutputs(entry: TaskCacheEntry; task: TaskInfo; projectDir: string; cfg: BauConfig): bool {....raises: [ ValueError, OSError, IOError, ValueError, HttpRequestError, LibraryError, Exception, OSError, SslError, IOError, TimeoutError, ProtocolError, KeyError], tags: [ ReadDirEffect, RootEffect, ReadIOEffect, WriteIOEffect, TimeEffect, WriteDirEffect], forbids: [].}
- Save declared task outputs to the configured remote cache.
proc saveTaskOutputs(entry: TaskCacheEntry; task: TaskInfo; projectDir: string) {. ...raises: [OSError, IOError, OSError, IOError, ValueError, OSError, IOError], tags: [ WriteDirEffect, ReadDirEffect, TimeEffect, WriteIOEffect, RootEffect, ReadIOEffect], forbids: [].}
-
Save declared task outputs into a local cache entry.
Writes are staged and moved into place under a cache lock.
proc taskCacheEntry(task: TaskInfo; projectDir: string; cfg: BauConfig; profile: string; selection: FeatureSelection = FeatureSelection(); taskArgs: openArray[string] = []): TaskCacheEntry {. ...raises: [KeyError, OSError, ValueError, IOError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect, ReadIOEffect], forbids: [].}
- Build the local cache entry descriptor for a task invocation.
proc taskCacheKey(task: TaskInfo; projectDir, profile: string; cfg: BauConfig; selection: FeatureSelection = FeatureSelection(); taskArgs: openArray[string] = []): string {. ...raises: [KeyError, OSError, ValueError, IOError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect, ReadIOEffect], forbids: [].}
- Return the deterministic cache key for a task invocation.
proc taskCacheKeyInputs(task: TaskInfo; projectDir, profile: string; cfg: BauConfig; selection: FeatureSelection = FeatureSelection(); taskArgs: openArray[string] = []): seq[string] {. ...raises: [KeyError, OSError, ValueError, IOError], tags: [ReadEnvEffect, ReadDirEffect, RootEffect, ReadIOEffect], forbids: [].}
- Return the textual inputs used to derive a task cache key.