Add an implementation of a Prometheus client. This is because the
prom-client implementation seems to have missunderstood how Prometheus
is supposed to work and doesn't allow updating collectors via
asynchronous callback.
Change Instance class to be a subclass of Link and refactor the
communication to and establisment of instances to use a virtual
connection between the slave and the instance. This is simplifies the
implementation of plugin communication for instances.
Replace InstanceRequest with a forwardTo option to Request which does
the task of forwarding in a much cleaner way.
Replace the sources/targets concept with a links array in the message
definitions. Fixes the problem of the actual links the messages applies
to being ambigious when there's multiple sources and targets.
Remove connection and client subclasses of Link and put the connection
logic into a "connector" class. The connector deals with sending
and receiving messages, handling the connection and reconnection of lost
connections and giving sequence numbers to messages.
This move the logic of the actual connection away from the link
sub-classes, which in turn means the connection should be a lot easier
to mock in tests.
Merge the events and requests categories in lib/link into messages and
use the class name of the message to determine which handler to call.
Also swaps the order of the arguments for forwardInstanceRequest to be
consistent with the rest of the lib/link code and fixes up the docs for
requests and events.
Add instance output event that is forwarded by the master server to
control connections that are subscribing to them. Add code subscribing
to the relevant instance output when dealing with instances in
clusterctl.
Check if Factorio terminated as a result of SIGKILL and throw an error
suggesting the system may be low on memory as a cause. Also print exit
code if the unexpected shutdown occured without a signal.
Rework client.js to support running multiple instances at once and be
managed remotely and implement the neccessary communication
infrastructure for this.
Due to circular dependencies on the implementation of this the master
branch is significantly broken after this.
If the RCON client is currently in the process of connecting to the
Factorio server then wait for it to complete the connection to avoid it
emmiting out an error connecting in FactorioServer.stop().
Move item database, tests, endpoint definitions for /api/place,
/api/remove, /api/inventory, /api/inventoryAsObject, and the web
interface view for the storage page into the clusterioMod plugin.
Remove the unused and badly behaved getCommand and getLua functions from
clusterTools. The main issue with these is that encourage the use of
large commands that have negative impact on the performance of the
servers, as such large commands have to be transmitted to all players
that are connected. These functions also have poor handling of lua
comments and will fail on strings containing for example "--".
Remove Hotpatch and implement a save patcher in its place. The save
patcher takes a normal Factorio save and adds modules to it that's
loaded by a generated control.lua file. This greatly reduces the
difficulty of adding an existing game to Clusterio and using scenario
code in plugins.
The mechanism for selecting what code to patch into the saves from
plugins is temorary and expected to change with #220.
Add a hashStream method to lib/hash that does the same as hashFile only
with a stream instead of a file path and implement tests for both of
these methods.
Move getFactorioLocale to the new lib/factorio namespace and refactor it
to use async functions instead of callbacks. Split tests into
integration with factorio and testing of the function itself.
Also removes the cacheing from the function itself as this breaks the
isolated testing of it.
Break out the server process management to a new FactorioServer class in
lib/factorio. This class takes responsibility for managing a factorio
server, communicating with it and handling the stopping of it. It also
replaces the previous effort to do this in lib/factorioServer.
This change also updates the version of rcon-client, and since the
author of it has updated it to use UTF-8 the fork is no longer
necessary. It also removes the messageInterface implementation
in favor of just calling the rcon-client library directly since
this has rate limiting logic built in.
The lib/factorio library is intended to abstract all the interfacing
that happens with Factorio.
Create a random instance ID using Math.random instead of deriving it
from the RCON password with a hombrew hash algorithm. Remove
stringUtils as it's no longer needed.
Simplify getNewestFile by converting it to an async function, use the
fs-extra promise based fs functions and remove the files argument as
well as the callback.
Refactors the tests as well to use the test/temp folder.
Add missing.js test files that requires any files that currently does
not have any unit tests defined for them. This should hopefully make it
so that when unit tests are added for parts of these files the coverage
will increase instead of decreasing.
Note that this does not include CLI Tools/ as those are not testable.
Remove lib/manager/configManager.js and the config management command
line interface as well as the serverManager's web interface for config
management. The configuration rewrite will work differently and is not
compatible with configManager.js.
Replace the instancedirectory variable with an Instance class that holds
the directory and has a .path() to get paths relative to the instance
directory.
Merge the masterIP and masterPort configuration entries into a single
masterURL entry. Fixes the problem with connecting to an HTTPS version
of the master server and also makes it easier to host the master server
behind a reverse proxy.
This breaks all known code interfacing Clusterio.
Remove the compiled output of veladon's clusterioModel project. The
source code can be found at https://github.com/veladon/clusterioModel
and doesn't really belong in Clusterio as it's specific to the train
teleports plugin.
Change the ugly global slaves object to be a member of the db object and
implement the items database as a separate integrety verifying class in
lib/database.