import { Monitor } from '@neo-one/monitor';
import { BaseResource, BaseResourceOptions, CreateHook, DescribeTable, MasterResourceAdapter, ResourceAdapter, ResourceDependency, ResourceType, TaskList } from '@neo-one/server-plugin';
import { Observable } from 'rxjs';
import { PluginManager } from './PluginManager';
import { PortAllocator } from './PortAllocator';
export interface InitError {
    readonly resourceType: string;
    readonly resource: string;
    readonly error: Error;
}
export declare class ResourcesManager<Resource extends BaseResource = BaseResource, ResourceOptions extends BaseResourceOptions = BaseResourceOptions> {
    readonly resourceType: ResourceType<Resource, ResourceOptions>;
    readonly masterResourceAdapter: MasterResourceAdapter<Resource, ResourceOptions>;
    readonly resources$: Observable<readonly Resource[]>;
    private readonly monitor;
    private readonly pluginManager;
    private readonly portAllocator;
    private readonly plugin;
    private readonly resourceAdapters$;
    private readonly mutableDirectResourceDependents;
    private readonly mutableResourceDependents;
    private readonly mutableCreateHooks;
    private readonly resourcesPath;
    private readonly resourcesReady;
    private readonly directDependentsPath;
    private readonly dependenciesPath;
    private readonly mutableCreateTaskList;
    private readonly mutableDeleteTaskList;
    private readonly mutableStartTaskList;
    private readonly mutableStopTaskList;
    private readonly mutableResourceAdaptersStarted;
    constructor({ monitor, dataPath, pluginManager, resourceType, masterResourceAdapter, portAllocator, }: {
        readonly monitor: Monitor;
        readonly dataPath: string;
        readonly pluginManager: PluginManager;
        readonly resourceType: ResourceType<Resource, ResourceOptions>;
        readonly masterResourceAdapter: MasterResourceAdapter<Resource, ResourceOptions>;
        readonly portAllocator: PortAllocator;
    });
    private readonly resourceAdapters;
    reset(): Promise<void>;
    destroy(): Promise<void>;
    getResources$(options: ResourceOptions): Observable<readonly Resource[]>;
    getResource$({ name, options, }: {
        readonly name: string;
        readonly options: ResourceOptions;
    }): Observable<Resource | undefined>;
    getResource({ name, options, }: {
        readonly name: string;
        readonly options: ResourceOptions;
    }): Promise<Resource>;
    create(name: string, options: ResourceOptions): TaskList;
    delete(name: string, options: ResourceOptions): TaskList;
    start(name: string, options: ResourceOptions): TaskList;
    stop(name: string, options: ResourceOptions): TaskList;
    addDependent(name: string, dependent: ResourceDependency): void;
    addCreateHook(hook: CreateHook): void;
    getResourceAdapter(name: string): ResourceAdapter<Resource, ResourceOptions>;
    getDebug(): DescribeTable;
    init(): Promise<readonly InitError[]>;
    private initName;
    private readDeps;
    private deleteDeps;
    private getStartDeps;
    private startDeps;
    private getStopDeps;
    private stopDeps;
    private destroyName;
    private getSimpleName;
    private getDirectDependentsPath;
    private getDependenciesPath;
    private addDependents;
    private uniqueDeps;
}
