/** * Copyright (c) 2018-present, tarant * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import IProcessor from '../fiber/processor'; import { IActor } from './actor'; import IActorSystemConfiguration from './configuration/actor-system-configuration'; export default class ActorSystem implements IProcessor { static for(configuration: IActorSystemConfiguration): ActorSystem; static default(): ActorSystem; readonly requirements: string[]; private readonly actors; private readonly subscriptions; private readonly mailbox; private readonly fiber; private readonly materializers; private readonly resolvers; private readonly supervisor; private constructor(); process(): Promise; /** * Stops the actor system and frees all actors */ free(): void; /** * Creates a new root actor. * * @param classFn Constructor of the actor to create * @param values Parameters to pass to the constructor */ actorOf(ClassFn: new (...args: any[]) => T, values: any[]): T; /** * Looks for an existing actor in this actor system. If none exist, * it will try to resolve the actor, by id, with the provided resolvers. * * @param id Id of the actor to find */ actorFor(id: string): Promise; /** * Converts a function to a function actor, with the same signature. Function actors behave the same way as * actors, but can be called as ordinary functions. * * Like actors, there is a limitation on the signature of the function. It can receive any number and type * of parameters, but it *must* return a Promise. * * @param fn Function to be wrapped in an actor */ functionFor(fn: T): T; /** * Tries to find an actor, if it doesn't exist, creates a new one. * * @param id Id of the actor to find * @param elseClass Constructor of the actor to create, if doesn't exist * @param values Parameters of the constructor */ resolveOrNew(id: string, elseClass: new (...args: any[]) => T, values: any[]): Promise; private setupInstance; }