Skip to content

Conversation

techsavvyash
Copy link

@techsavvyash techsavvyash commented Feb 9, 2024

This PR includes the following changes:

  1. Setup a server that listens on the port sent via the command line argument port. -- This file also connects to an internal socket which is then used to talk to other RAFT nodes in the cluster.
  2. A WIP client.ts file which talks to the nodes in the cluster as an external client and to send GET/SET requests.
  3. Refactor the code into smaller modules.

Also refer CONTRIBUTING.md


## Project Structure

This project is a normal NodeJS project with a target of using as less NPM dependencies as much possible.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May not be the goal here. Building the fastest JS implementation is.

- [`./server.js`](./server.js) - This file setsup a server to accept connections and respond to requests from client. This is the file where the Raft Node is instantiated and connected to the other nodes in the cluster.

## How to Contribute?
- Refer to issue tickets on [Github](https://github.com/techsavvyash/stylusdb-js)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change remote

raft/index.js Outdated
// RPC command
case 'rpc':
//TODO Check this make sure that it is called through the leader of
console.log("RAHUL in command case :", raft.leader === this.address)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also convert all console logs to proper logging. Pino is a good alternative.


raft.change({ term: 139 });
raft.emit('data', {
address: 'vladimir',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file?

var LifeRaft = require('../raft/index');
const Log = require('../raft/log');

const DBManager = require('../db');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's pick one. Leaning towards DBManager. Let's remove LMDBManager altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants