Please checkout the Docu of INopeInstanceManager

Hierarchy

  • NopeInstanceManager

Implements

Constructors

Properties

constructorServices: INopeObservable<string[], string[], string[], IEventAdditionalData>

Contains the rpcs used to create instances.

constructors: IMapBasedMergeData<string, string[], string, string>

Element showing the available services. Its more or less a map, that maps the services with their dispatchers.

T = services name. K = dispatcher - ids

Author

M.Karkowski

Memberof

NopeInstanceManager

Element showing the available instances. Its more or less a map, that maps the instances with their dispatchers.

  • originalKey = DispatcherID (string);
  • originalValue = Available Instance Messages (IAvailableInstancesMsg);
  • extractedKey = The name of the Instance (string);`
  • extractedValue = instance-description (INopeModuleDescription);

Author

M.Karkowski

Memberof

NopeInstanceManager

internalInstances: INopeObservable<string[], string[], string[], IEventAdditionalData>

Contains the identifiers of the instances, which are hosted in the provided dispatcher.

Author

M.Karkowski

Memberof

NopeInstanceManager

ready: INopeObservable<boolean, boolean, boolean, IEventAdditionalData>

Flag to indicate, that the system is ready.

Author

M.Karkowski

Memberof

NopeInstanceManager

Methods

  • Allows to create an instance. This might be the case on remote dispatchers or on the same element. Only a wrapper is returned, which communicates with a dispatcher, because we dont know where the element is provided. To know which instanceManager hosts the instance can use the INopeInstanceManager.getDispatcherForInstance method. The returned wrapper behaves like a normal "internal" class. If this method is called, a {@link IGenericNopeModule} is returned as type by default. If a special wrapper is required for a type, such wrappers can be defined and customized via registerInternalWrapperGenerator and unregisterInternalWrapperGenerator. Here, too, the type is decisive. *

    If there are multiple INopeInstanceManager able to create an instance, the selector is used to select a dispatcherand its instanceManger, to create the instance.

    If the instances already exists and the type is matching, the assignmentValid callback is used, to test if the required assignmet could be valid. E.g. you require the instance to be hosted on a specific host. The assignmentValid will check if the assignment is valid.

    Example

    // Create an Instance:
    const instance = await manager.createInstance<TestModule>({
    identifier: "instance", // <- Must be provided
    type: "TestModule", // <- Must be provided and present in the Network
    params: ["p1", "p2"], // <- Optional. The Parameters, required by the class to initialize see {@link INopeModule.init}
    });

    Author

    M.Karkowski

    Returns

    Memberof

    INopeInstanceManager

    Type Parameters

    Parameters

    Returns Promise<I & IGenericNopeModule>

  • Disposes an instance and removes it. Thereby the Instance wont be available for other InstanceManagers in the system.

    Author

    M.Karkowski

    Returns

    Memberof

    INopeInstanceManager

    Type Parameters

    Parameters

    • instance: string | I

      The Instance to consider

    • preventSendingUpdate: boolean = false
    • callInstanceDispose: boolean = true

    Returns Promise<boolean>

  • Helper to get the corresponding Service name

    Returns

    the name.

    Parameters

    • name: string

      name

    • type: "constructor" | "dispose"

      The desired type of the requested service name

    Returns string

  • Registers a Constructor, that enables other NopeInstanceManagers to create an instance of the given type. Therefore a callback "cb" is registered with the given "typeIdentifier".

    The function allways need as callback which must return a INopeModule (or an extension of it)

    Example:

    Example

    // Now we register the constructor with the type 'TestModule'
    await manager.registerConstructor(
    "TestModule",
    async (core, identifier) => {
    assert(
    identifier === "instance",
    "The identifier has not been transmitted"
    );
    return new TestModule(core);
    }
    );

    Author

    M.Karkowski

    Returns

    Memberof

    INopeInstanceManager

    Type Parameters

    Parameters

    • identifier: string

      The identifier for the Constructor (Like a service)

    • cb: TConstructorCallback<I>

      The callback used, to create an instance.

    Returns Promise<void>

Generated using TypeDoc