0.11.0 • Published 5 years ago

@slimio/core v0.11.0

Weekly downloads
25
License
MIT
Repository
github
Last release
5 years ago

Core

The Core was created to load and manage SlimIO addons, it will create/handle communication between each addons.

Each addon are isolated from each others (designed like container above).

Requirements

Features / Roles

  • (Re)loading addons.
  • Manage communication between addons.
  • Retention of communications in case of anomalies.
  • Monitoring isolation.

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i @slimio/core
# or
$ yarn add @slimio/core

Usage example

A script that demonstrate how to load a default core (Configuration will be created dynamically).

const Core = require("@slimio/core");

async function main() {
    console.time("start_core");
    const core = await (new Core(__dirname)).initialize();
    console.timeEnd("start_core");

    // Handle exit signal!
    process.on("SIGINT", () => {
        console.error("Exiting SlimIO Agent (please wait)");
        core.exit().then(() => {
            setImmediate(process.exit);
        }).catch(function mainErrorHandler(error) {
            console.error(error);
            process.exit(1);
        });
    });
}
main().catch(console.error);

API

Create a new instance of Core Object. The argument dirname is the root directory where the core have to load his configuration and all addons.

The constructor take an optional options object which contain all options to configure the core Agent.

interface ConstructorOptions {
    silent?: boolean;
    autoReload?: number;
}

Initialize the Core (it will load configuration and addons). The loading of addons is lazy, so the response will be returned before the addons have had time to fully load.

Stop the core and all affiliated ressources (addons, config etc..).

Note: Think to exit the process with an iteration + 1 (with setImmediate).

Dependencies

NameRefactoringSecurity RiskUsage
@slimio/addon⚠️MajorHighAddon default class
@slimio/configMinorHighConfiguration interaction
@slimio/ipc⚠️MajorHighInter-process communication
@slimio/isMinorLowType checker
@slimio/safe-emitterMinorHighSafe emittter
@slimio/schedulerMinorLowScheduler
@slimio/utilsMinorHighBunch of useful functions
make-promises-safe⚠️MajorHighPromise not exit process when fail

License

MIT

0.11.0

5 years ago

0.10.0

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.0

5 years ago

0.7.4

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago