import { ITransport } from './infra';
import { ITime } from '@darlean/utils';
import { MultiTypeInstanceContainer } from './instances';
import { IActorRegistrationOptions, IActorSuite, IPersistence, IPortal, IRemote } from '@darlean/base';
import { DistributedActorRegistry } from './distributedactorregistry';
import { IPersistenceServiceOptions } from '@darlean/persistence-suite';
import { IFsPersistenceOptions } from '@darlean/fs-persistence-suite';
export declare const DEFAULT_CAPACITY = 1000;
export declare const DEFAULT_LOCAL_APP_ID = "local";
/**
 * Class that hosts actors and (depending on the configuration) exposes them remotely. Typically
 * created by means of an {@link ActorRunnerBuilder}.
 */
export declare class ActorRunner {
    protected portal: IPortal;
    protected waiters: Array<() => void>;
    protected delayedStop: number;
    protected stopped: boolean;
    protected stopping: boolean;
    protected starting: boolean;
    protected starters: Array<{
        order: number;
        name: string;
        starter: () => Promise<void>;
    }>;
    protected stoppers: Array<{
        order: number;
        name: string;
        stopper: () => Promise<void>;
    }>;
    constructor(portal: IPortal);
    getPortal(): IPortal;
    start(): Promise<void>;
    stop(): Promise<void>;
    addStarter(starter: () => Promise<void>, order: number, name: string): void;
    addStopper(stopper: () => Promise<void>, order: number, name: string): void;
    /**
     * Starts the actor runner when not already started before, and waits until the actor runner is stopped, either explicitly
     * by calling the {@link stop} method, or because of application termination signals.
     */
    run(): Promise<void>;
}
/**
 * Class that can be used to build an {@link ActorRunner} based on provided configuration.
 */
export declare class ActorRunnerBuilder {
    protected actors: IActorRegistrationOptions<object>[];
    protected portal?: IPortal;
    protected persistenceFactory?: IPersistence<unknown> | ((actorType: string, specifiers?: string[]) => IPersistence<unknown>);
    protected appId: string;
    protected transport?: ITransport;
    protected remote?: IRemote;
    protected time?: ITime;
    protected defaultApps?: string[];
    protected runtimeApps?: string[];
    protected multiContainer?: MultiTypeInstanceContainer;
    protected transportMechanism: '' | 'nats';
    protected distributedRegistry?: DistributedActorRegistry;
    constructor();
    /**
     * Registers an individual actor that must be hosted by the actor runner.
     * @param options The options for the actor.
     * @returns The builder
     */
    registerActor<T extends object>(options: IActorRegistrationOptions<T>): ActorRunnerBuilder;
    /**
     * Registers a suite of actors that must be hosted by the actor runner.
     * @param suite The suite to be registered
     * @returns The builder
     */
    registerSuite(suite: IActorSuite): ActorRunnerBuilder;
    /**
     * Sets a list of appId's on which the runner will search for actors that do not
     * explicitly have their apps setting configured.
     * @param hosts
     */
    setDefaultApps(apps: string[]): ActorRunnerBuilder;
    setRuntimeApps(apps: string[]): ActorRunnerBuilder;
    /**
     * Configures the builder to allow remote access via Nats.
     * @param appId The app-id under which the actor runner will register to the cluster.
     * @param transport Optional transport that is used for remote access. When omitted,
     * the builder creates a {@link NatsTransport}.
     */
    setRemoteAccess(appId: string, transport?: ITransport): ActorRunnerBuilder;
    hostActorLock(nodes: string[], redundancy: number): void;
    hostActorRegistry(nodes: string[]): void;
    hostPersistence(options: IPersistenceServiceOptions): void;
    hostFsPersistence(options: IFsPersistenceOptions): void;
    /**
     * Overrides the default distributed persistence which is automatically enabled when {@link setPersistence} is not invoked.
     * @param persistence
     */
    setPersistence(factory: IPersistence<unknown> | ((actorType: string, specifiers?: string[]) => IPersistence<unknown>)): void;
    /**
     * Builds a new {@link ActorRunner} based on the provided configuration.
     * @returns a new ActorRunner
     */
    build(): ActorRunner;
    /**
     *
     * @returns a reference to the persistence service of the actor runner.
     */
    getPersistence(): IPersistence<unknown> | undefined;
    private createTime;
    private createBackOff;
    private createActorLock;
    private createPortal;
    private configurePortal;
    private createMultiContainer;
    private fillContainers;
    private createRemotePortal;
    private createRemote;
    private createPersistence;
    private createActorCreateContext;
    private registerAutoStarts;
}
