nx
Version:
50 lines (49 loc) • 1.91 kB
TypeScript
import { DefaultTasksRunnerOptions } from './default-tasks-runner';
import { Task } from '../config/task-graph';
export declare type CachedResult = {
terminalOutput: string;
outputsPath: string;
code: number;
remote: boolean;
};
export declare type TaskWithCachedResult = {
task: Task;
cachedResult: CachedResult;
};
export declare class Cache {
private readonly options;
root: string;
cachePath: string;
terminalOutputsDir: string;
latestOutputsHashesDir: string;
useFsExtraToCopyAndRemove: boolean;
constructor(options: DefaultTasksRunnerOptions);
removeOldCacheRecords(): void;
get(task: Task): Promise<CachedResult | null>;
put(task: Task, terminalOutput: string | null, outputs: string[], code: number): Promise<void>;
copyFilesFromCache(hash: string, cachedResult: CachedResult, outputs: string[]): Promise<void>;
temporaryOutputPath(task: Task): string;
removeRecordedOutputsHashes(outputs: string[]): Promise<void>;
shouldCopyOutputsFromCache(taskWithCachedResult: TaskWithCachedResult, outputs: string[]): Promise<boolean>;
private expandOutputsInWorkspace;
private expandOutputsInCache;
private _expandOutputs;
private copy;
private remove;
private recordOutputsHash;
private areLatestOutputsHashesDifferentThanTaskHash;
private getLatestRecordedHashForTask;
private isAnyOutputMissing;
private getFileNameWithLatestRecordedHashForOutput;
private getLatestOutputHashFilename;
private getFromLocalDir;
private createCacheDir;
private createTerminalOutputsDir;
private ensureLatestOutputsHashesDir;
private tryAndRetry;
}
/**
* Collapse Expanded Outputs back into a smaller set of directories/files to track
* Note: DO NOT USE, Only exported for unit testing
* */
export declare function collapseExpandedOutputs(expandedOutputs: string[]): string[];