/**
 * Represents a container of TObj's that can be created in the container from
 * the TData data. If the object corresponding to a particular data already
 * exists, it's returned instead of being created.
 */
export declare class Registry<TData, TObj> {
    private options;
    private map;
    constructor(options: {
        /** A handler which computes an unique key from the data provided. */
        key: (data: TData) => string;
        /** A handler which creates a new object from its data. */
        create: (data: TData) => TObj;
        /** This handler is called when an object is deleted from the registry. */
        end?: (obj: TObj) => Promise<unknown>;
    });
    /**
     * Computes the key for the data and returns the object corresponding to that
     * key if it already exists in the registry. Otherwise, creates a new object,
     * adds it to the registry and returns it.
     */
    getOrCreate(data: TData): [obj: TObj, key: string];
    /**
     * Deletes all objects from the registry except those whose keys are in the
     * keepKeys set. For each object, calls an optional end() handler.
     */
    deleteExcept(keepKeys: Set<string>): Promise<void>;
}
//# sourceMappingURL=Registry.d.ts.map