instances~InstanceManager()

The instance manager manages all instances.

new InstanceManager()

Methods

afterPropertiesSet()

Initialization after the components in the application context have been constructed.

clear() → {Promise.<boolean>}

Clears the list of instances.
Returns:
Promise.<boolean> - - Promise

connect(instanceNodeopt) → {Promise.<tree.Node>}

Connects to an instance.
Parameters:
Name Type Attributes Description
instanceNode tree.Node <optional>
The instance to connect to.
Returns:
Promise.<tree.Node>

create(identifieropt, typeopt, nameopt, descriptionopt, versionRangeopt, channelSearchopt, persistent, autostart, autoconnect, autorestart) → {Promise.<tree.Node>}

Creates an instance of Inexor Core. The instance is created but not started!
Parameters:
Name Type Attributes Default Description
identifier number <optional>
null the instance identifier
type string <optional>
the instance type - either server or client
name string <optional>
the name of the instance
description string <optional>
the description of the instance
versionRange string <optional>
0.x the semantic version range. The release the instance starts need to match with its version.
channelSearch string <optional>
* the version channel. The release has to have the same channel. It is determined by the version name (the github tag or the name of the folder/zip): version@channel, e.g. 0.2.3-alpha@stable
persistent boolean false True, if the instance should be persisted.
autostart boolean false True, if the instance should be started automatically on startup.
autoconnect boolean false True, if the instance should be connected automatically on startup.
autorestart boolean false True, if the instance should be restarted automatically on shutdown of the instance.
Returns:
Promise.<tree.Node> - - the tree node which represents the instance

disconnect(instanceNodeopt) → {Promise.<tree.Node>}

Disconnects from an instance.
Parameters:
Name Type Attributes Description
instanceNode tree.Node <optional>
The instance to disconnect from.
Returns:
Promise.<tree.Node>

exists(instanceIdopt) → {boolean}

Returns if an instance with the given identifier exists.
Parameters:
Name Type Attributes Description
instanceId number <optional>
the instance identifier
Returns:
boolean - - True, if the instance exists.

getCurrentProfile()

Returns the current profile.

getHostname()

Returns the hostname to listen on.

getInstancesByState(stateopt) → {array}

Returns an array of instance ids which the given state.
Parameters:
Name Type Attributes Description
state string <optional>
The state.
Returns:
array - - The list of instance ids.

getInstancesByType(stateopt) → {array}

Returns an array of instance ids which the given state.
Parameters:
Name Type Attributes Description
state string <optional>
The state.
Returns:
array - - The list of instance ids.

getPort()

Returns the port to listen on.

getTransition(oldStateopt, newStateopt) → {object}

Returns the state transistion.
Parameters:
Name Type Attributes Description
oldState string <optional>
The old state.
newState string <optional>
The new state.
Returns:
object - - The state transistion

isValidInstanceType(instance_typeopt) → {boolean}

Returns true if the given instance type is a valid type.
Parameters:
Name Type Attributes Description
instance_type string <optional>
The instance type.
Returns:
boolean - - True if the given instance type is a valid type.

killProcess(instanceNodeopt)

Kills the process of the given instance.
Parameters:
Name Type Attributes Description
instanceNode tree.Node <optional>
The instance node.

loadInstances(filenameopt) → {Promise.<bool>}

Loading instances from a TOML file.
Parameters:
Name Type Attributes Default Description
filename string <optional>
instances.toml The filename.
Returns:
Promise.<bool>

pause(instanceNode) → {Promise.<tree.Node>}

Pauses a running instance.
Parameters:
Name Type Description
instanceNode tree.Node The instance to stop.
Returns:
Promise.<tree.Node>

remove(instanceNodeopt) → {Promise.<instance>}

Removes an instance.
Parameters:
Name Type Attributes Description
instanceNode tree.Node <optional>
The instance to start.
Returns:
Promise.<instance>

resume(instanceNode) → {Promise.<tree.Node>}

Resumes a paused instance.
Parameters:
Name Type Description
instanceNode tree.Node The instance to stop.
Returns:
Promise.<tree.Node>

saveInstances(filenameopt) → {Promise.<bool>}

Saves a instances to a TOML file.
Parameters:
Name Type Attributes Default Description
filename string <optional>
instances.toml The filename.
Returns:
Promise.<bool>

setDependencies()

Sets the dependencies from the application context.

shutdownProcess(instanceNodeopt)

Shutdown the given process. Optionally kills the process.
Parameters:
Name Type Attributes Description
instanceNode tree.Node <optional>
The instance node.

start(instanceNodeopt) → {Promise.<instance>}

Starts an instance.
Parameters:
Name Type Attributes Description
instanceNode tree.Node <optional>
The instance to start.
Returns:
Promise.<instance>

startAll() → {Promise.<bool>}

Starts all available instances
Returns:
Promise.<bool>

stop(instanceNodeopt) → {Promise.<tree.Node>}

Stops an instance.
Parameters:
Name Type Attributes Description
instanceNode tree.Node <optional>
The instance to stop.
Returns:
Promise.<tree.Node>

stopAll() → {Promise.<bool>}

Stops all running instances.
Returns:
Promise.<bool>

transist(instanceNodeopt, oldStateopt, newStateopt) → {boolean}

Applies a state transition on an instance.
Parameters:
Name Type Attributes Description
instanceNode tree.Node <optional>
The instance on which the transition should apply.
oldState string <optional>
The old state.
newState string <optional>
The new state.
Returns:
boolean - - True if the given state transition is valid.