harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
19 lines (18 loc) • 953 B
TypeScript
/**
* Register a handler to be called when storage free space is low and reclamation is needed. The callback is called
* with the priority of the reclamation, which is the ratio of the threshold to the available space ratio. If space is
* low, the priority will be greater than 1. If the reclamation is successful, the callback will be called again with
* a priority of 0.
* @param path
* @param handler
*/
export declare function onStorageReclamation(path: string, handler: (priority: number) => Promise<void> | void, skipThreadCheck?: boolean): void;
/**
* Run the registered reclamation handlers, if any disk drives are below the threshold
*/
export declare function runReclamationHandlers(): Promise<void>;
/**
* Set the function used to get the available space ratio (for testing and backfill for Node v16)
* @param newGetter
*/
export declare function setAvailableSpaceRatioGetter(newGetter?: (path: string) => Promise<number>): void;