Create the Instance Manager.
Readonly
constructorContains the rpcs used to create instances.
Readonly
constructorsElement showing the available services. Its more or less a map, that maps the services with their dispatchers.
T = services name. K = dispatcher - ids
M.Karkowski
NopeInstanceManager
Readonly
instancesElement 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
);M.Karkowski
NopeInstanceManager
Readonly
internalContains the identifiers of the instances, which are hosted in the provided dispatcher.
M.Karkowski
NopeInstanceManager
Readonly
readyFlag to indicate, that the system is ready.
M.Karkowski
NopeInstanceManager
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 dispatcher
and 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.
// 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}
});
M.Karkowski
INopeInstanceManager
The Type of the Return type.
Description requrired to create the Message (see IInstanceCreationMsg).
The properties type
and identifier
must be provided.
Additional Options used during creating the Instance
Optional
assignmentOptional
linkOptional
linkOptional
selector?: ValidSelectorFunctionDisposes an instance and removes it. Thereby the Instance wont be available for other InstanceManagers in the system.
M.Karkowski
INopeInstanceManager
The Instance to consider
Manual function, used to generate a Wrapper. This should only be called, when instances are registerd with registerInstance is used and you are shure, that the instance is created manually. Please allways prefer to use createInstance
Returns the instance Description for a specific instance. It is just a simplified wrapper for the "instances"-property.
M.Karkowski
INopeInstanceManager
The identifier for instance (its name)
Creates Wrappers for the Type of the given element.
Returns the hosting dispatcher for the given instance.
M.Karkowski
The Status or false if not present.
INopeInstanceManager
The identifier for instance (its name)
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)
// 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);
}
);
M.Karkowski
INopeInstanceManager
The identifier for the Constructor (Like a service)
The callback used, to create an instance.
Option, to statically register an instance, without using an specific generator etc. This instance is just present in the network.
M.Karkowski
INopeInstanceManager
The Instance to consider
Defaultly a generic wrapper will be returned, when an instance is created. you can specifiy specific wrapper type for different "typeIdentifier" with this method.
M.Karkowski
INopeInstanceManager
The identifier for the Constructor (Like a service)
The Callback which creates the specific wrapper.
Describes the Data.
Unregisters a present Constructor. After this, created instances are still valid, the user isnt able to create new ones.
M.Karkowski
INopeInstanceManager
The identifier for the Constructor (Like a service)
Generated using TypeDoc
Please checkout the Docu of INopeInstanceManager