import {CacheKey} from './fingerprint.zena'; import {OutputManifest} from './manifest.zena'; import {StepKey} from './step.zena'; /** * Maps cache keys to previously recorded output manifests. Hosts back * this with a directory, a server, a database, or memory. Returning a * manifest from `get` asserts that the result exists and is * restorable; moving output bytes around is the host's business. The * step key accompanies the cache key so a host can shard storage by * step (e.g. a cache directory per package). */ export interface StepCache { get(step: StepKey, key: CacheKey): Future; put(step: StepKey, key: CacheKey, manifest: OutputManifest): Future; } /** A cache that stores nothing; every lookup misses. */ export class NullCache implements StepCache { async get(step: StepKey, key: CacheKey): Future { return null; } async put(step: StepKey, key: CacheKey, manifest: OutputManifest): Future {} }