import { GitProject } from "@atomist/automation-client/lib/project/git/GitProject";
import { GoalInvocation, GoalProjectListenerRegistration } from "../../../api/goal/GoalInvocation";
import { PushTest } from "../../../api/mapping/PushTest";
export declare const CacheInputGoalDataKey = "@atomist/sdm/input";
export declare const CacheOutputGoalDataKey = "@atomist/sdm/output";
/**
 * Goal cache interface for storing and retrieving arbitrary files produced
 * by the execution of a goal.
 * @see FileSystemGoalCache`
 */
export interface GoalCache {
    /**
     * Add a set of files (or directories) to the cache.
     * @param gi The goal invocation for which the cache needs to be stored.
     * @param p The project where the files (or directories) reside.
     * @param files The files (or directories) to be cached.
     * @param classifier An optional classifier to identify the set of files (or directories to be cached).
     * @param type An optional output type
     */
    put(gi: GoalInvocation, p: GitProject, files: string | string[], classifier?: string): Promise<string>;
    /**
     * Retrieve files from the cache.
     * @param gi The goal invocation for which the cache needs to be restored.
     * @param p he project where the files (or directories) need to be restored in.
     * @param classifier Optionally the classifier of the cache for the files to be restored. If not defined,
     *                   all caches for the GoalInvocation are restored.
     */
    retrieve(gi: GoalInvocation, p: GitProject, classifier?: string): Promise<void>;
    /**
     * Remove files from the cache.
     * @param gi The goal invocation for which the cache needs to be removed.
     * @param classifier Optionally the classifier of the cache for the files to be removed. If not defined,
     *                   all classifiers are removed.
     */
    remove(gi: GoalInvocation, classifier?: string): Promise<void>;
}
/**
 * Suitable for a limited set of files adhering to a pattern.
 */
export interface GlobFilePattern {
    globPattern: string | string[];
}
/**
 * Suitable for caching complete directories, possibly containing a lot of files.
 */
export interface DirectoryPattern {
    directory: string;
}
export interface CacheEntry {
    classifier: string;
    pattern: GlobFilePattern | DirectoryPattern;
}
/**
 * Core options for goal caching.
 */
export interface GoalCacheCoreOptions {
    /**
     * Optional push test on when to trigger caching
     */
    pushTest?: PushTest;
    /**
     * Optional listener functions that should be called when no cache entry is found.
     */
    onCacheMiss?: GoalProjectListenerRegistration | GoalProjectListenerRegistration[];
}
/**
 * Options for putting goal cache entries.
 */
export interface GoalCacheOptions extends GoalCacheCoreOptions {
    /**
     * Collection of glob patterns with classifiers to determine which
     * files need to be cached between goal invocations, possibly
     * excluding paths using regular expressions.
     */
    entries: Array<CacheEntry & {
        type?: string;
    }>;
}
/**
 * Options for restoring goal cache entries.
 */
export interface GoalCacheRestoreOptions extends GoalCacheCoreOptions {
    entries?: Array<{
        classifier: string;
    }>;
}
/**
 * Goal listener that performs caching after a goal has been run.
 * @param options The options for caching
 * @param classifier Whether only a specific classifier, as defined in the options,
 * needs to be cached. If omitted, all classifiers are cached.
 * @param classifiers Additional classifiers that need to be created.
 */
export declare function cachePut(options: GoalCacheOptions, classifier?: string, ...classifiers: string[]): GoalProjectListenerRegistration;
export declare const NoOpGoalProjectListenerRegistration: GoalProjectListenerRegistration;
/**
 * Goal listener that performs cache restores before a goal has been run.
 * @param options The options for caching
 * @param classifier Whether only a specific classifier, as defined in the options,
 * needs to be restored. If omitted, all classifiers defined in the options are restored.
 * @param classifiers Additional classifiers that need to be restored.
 */
export declare function cacheRestore(options: GoalCacheRestoreOptions, classifier?: string, ...classifiers: string[]): GoalProjectListenerRegistration;
/**
 * Goal listener that cleans up the cache restores after a goal has been run.
 * @param options The options for caching
 * @param classifier Whether only a specific classifier, as defined in the options,
 * needs to be removed. If omitted, all classifiers are removed.
 * @param classifiers Additional classifiers that need to be removed.
 */
export declare function cacheRemove(options: GoalCacheOptions, classifier?: string, ...classifiers: string[]): GoalProjectListenerRegistration;
/**
 * Interpolate information from goal invocation into the classifier.
 */
export declare function resolveClassifierPath(classifier: string | undefined, gi: GoalInvocation): Promise<string>;
/**
 * Sanitize classifier for use in path.  Replace any characters
 * which might cause problems on POSIX or MS Windows with "_",
 * including path separators.  Ensure resulting file is not "hidden".
 */
export declare function sanitizeClassifier(classifier: string): string;
//# sourceMappingURL=goalCaching.d.ts.map