@dappnode/dappnodesdk
Version:
dappnodesdk is a tool to make the creation of new dappnode packages as simple as possible. It helps to initialize and publish in ethereum blockchain
35 lines (34 loc) • 1.14 kB
TypeScript
type CacheMap = Map<string, string>;
/**
* Read and parse local cache file
*/
export declare function loadCache(cachePath?: string): CacheMap;
/**
* Add entry to local cache
*/
export declare function writeToCache({ key, value }: {
key: string;
value: string;
}, cachePath?: string): void;
/**
* Stringify and write cacheMap to local cache file
*/
export declare function writeCache(cache: CacheMap, cachePath?: string): void;
/**
* Returns a single deterministic cache key from an array of image tags
* @param imageTags
* @returns "dappmanager.dnp.dappnode.eth:0.2.24/sha256:0d31e5521ef6e92a0efb6110024da8a3517daac4b1e4bbbccaf063ce96641b1b"
*/
export declare function getCacheKey(imageTags: string[]): Promise<string>;
/**
* Prune local cache by removing entries of images that are no longer in disk
* @param cachePath
*/
export declare function pruneCache(cachePath?: string): Promise<void>;
/**
* Pure function version of pruneCache to ease testing
* @param cache
* @param imageIds ["6b74b6ba423e, "4a67065ab84a"]
*/
export declare function _pruneCache(cache: CacheMap, imageIds: string[]): CacheMap;
export {};