New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@kele23/level-sync

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@kele23/level-sync

_!Repository under development!_

unpublished
latest
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

LEVEL SYNC

!Repository under development!

Sync multiple LevelDB instances. It works on both browser and nodejs!!!

Usage

// create level-logged
const db = new LevelLogged(new Level()<string, any>('./db'));

// create a connection
const p2p = new Peer();
const connection = new P2PConnection(p2p);
p2p.on('connection', (dataConnection) => {
    connection.incomingConnection(dataConnection);
});

// connect connection & db with the sync manager
const sync = new SyncManager(db, connection);

// various sync
sync.doPull(); // pull from other db to mine
sync.doPush(); // push from my db to other
sync.doSync(); // pull and then push
sync.doSync(interval); // make a sync every <interval> seconds
sync.isScheduled(); // true if there is a sync scheduled
sync.stopSync();

Types of connections

P2P Connection based on PeerJS

const p2p = new Peer(); // PeerJS
const connection = new P2PConnection(p2p);
p2p.on('connection', (dataConnection) => {
    connection.incomingConnection(dataConnection);
});

Generic CLIENT-SERVER

Client

const connection = new ClientConnection(async (data) => {
    return await axios.put(...
});

Server

const connection = new ServerConnection();
server.onReceive(async (data) => {
    return await connection.incomingReceive(data);
});

Conflicts

When a Master - Master replication occurs it is always possible for conflicts to occur.

Conflicts can arise in various situations, the most common is that both DBs have modified the same key and therefore it is necessary to understand which of the two versions to keep. For the moment, conflicts are resolved by maintaining the "remote" version, in order to be as simple as possible.

As soon as possible we will also try to implement a custom management.

Next Steps

  • Verify AbstractLevel implementation & Create test suite ( found the correct test framework )
  • Versioning ( mantain old versions of elements if is possible )
  • Log cleaning ( purge too old logs )
  • Reduce communication overhead
  • Batch communication & batch commit

FAQs

Package last updated on 18 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts