fluctor

    0.2.3 • Public • Published

    fluctor

    Flux-like + Actor Model

    Npm Package

    Build Status Dependencies Coverage Status

    Well, this is a library for creating a shared state across multiple instances;

    Installation

    npm:

    npm install fluctor

    What is it?

    Well once you create a fluctor object you have an immutalbe state that you can change with transactions

    const Fluctor = require('fluctor').Fluctor;
     
     
    var fluctor = new Fluctor({
      initial: {}, // initial state
      connection: {} // connection settings
    });
     
    fluctor.state // => the state
     
    fluctor
      .tran // can be acessed as fluctor.transactions too
      .begin() // begin the transactions
      .set('foo', 'bar') // Do the change
      .commit() // commit the changes (you can rollback too)
      .then(() => 
        console.log('Transaction Commited'));
     
    fluctor.state // => { "foo": "bar" } is the value here and every other server

    Transaction

    let tran = fluctor.tran.begin();
     
    tran.set(path, value); // Set value
     
    tran.remove(path); // Delete value
     
    tran.push(path, value); // Appends value to an array
     
    tran.pop(path); // Pops last value from array
     
    tran.increment(path, value=1); // Increment Numeric value
     
    tran.decrement(path, value=1); // Decrement Numeric value
     
    tran.commit()
      .then(changes => { /* the returning value from the modifications */ });
     

    Roadmap

    This project started as a personal need and i figured out that it should be a fully fledged library. That means there are a lot of tasks to be completed befor the library is production ready =]

    • Make the thing production ready
    • Make the Appenders be plugginable
    • Figure out a custom p2p comunication
    • Settle on a more strict role splitting among nodes
    • Maybe transfer some of the core code to native code

    License

    MIT © Dmitry Dodzin

    Install

    npm i fluctor

    DownloadsWeekly Downloads

    17

    Version

    0.2.3

    License

    MIT

    Last publish

    Collaborators

    • uncledick