Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

Commit

Permalink
change clusterluck to notp (external code audit at azuqua)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinwilson541 committed Feb 12, 2019
1 parent d539f81 commit 52795fe
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 113 deletions.
146 changes: 73 additions & 73 deletions CHANGELOG.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Clusterluck
===========

[![Build Status](https://travis-ci.org/azuqua/clusterluck.svg?branch=master)](https://travis-ci.org/azuqua/clusterluck)
[![Code Coverage](https://coveralls.io/repos/github/azuqua/clusterluck/badge.svg?branch=master)](https://coveralls.io/github/azuqua/clusterluck?branch=master)
[![Build Status](https://travis-ci.org/azuqua/notp.svg?branch=master)](https://travis-ci.org/azuqua/notp)
[![Code Coverage](https://coveralls.io/repos/github/azuqua/notp/badge.svg?branch=master)](https://coveralls.io/github/azuqua/notp?branch=master)

[Documentation](https://azuqua.github.io/clusterluck)
[Documentation](https://azuqua.github.io/notp)

A library for writing distributed systems that use a gossip protocol to communicate state management, consistent hash rings for sharding, and vector clocks for history.

## Install

```
$ npm install clusterluck
$ npm install notp
```

## Dependencies
Expand Down Expand Up @@ -77,7 +77,7 @@ Clusterluck can be used as a module to write decentralized distributed systems w

To get started, we can use the following code:
```javascript
const cl = require("clusterluck");
const cl = require("notp");

let node = cl.createCluster("foo", "localhost", 7022);
node.start("cookie", "ring", () => {
Expand Down Expand Up @@ -137,7 +137,7 @@ For documentation on available methods/inputs for cluster manipulation, visit th
In an example.js file, insert the following:

```javascript
const cl = require("clusterluck"),
const cl = require("notp"),
os = require("os");

let id = process.argv[2],
Expand Down Expand Up @@ -170,7 +170,7 @@ If we then go to inspect the ring on each node, we should see both node `foo` an
#### <a name="WritingGenServers"></a>Writing GenServers

The `GenServer` class is used to create actors that send messages around and receive messages from the rest of the cluster.
They're the basic unit of logic handling in clusterluck, and heavily derived off of Erlang's gen_server's, but incorporated into node.js' EventEmitter model.
They're the basic unit of logic handling in notp, and heavily derived off of Erlang's gen_server's, but incorporated into node.js' EventEmitter model.
To start a `GenServer` with no event handling, we can use the following code:

```javascript
Expand Down
2 changes: 1 addition & 1 deletion examples/gen_server/dlm/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DLM example
===========

A distributed lock manager `gen_server` implementation for reference, using the [Redlock algorithm](https://redis.io/topics/distlock). May be added into clusterluck as an optional feature if there's community interest.
A distributed lock manager `gen_server` implementation for reference, using the [Redlock algorithm](https://redis.io/topics/distlock). May be added into notp as an optional feature if there's community interest.

Example Usage
-------------
Expand Down
2 changes: 1 addition & 1 deletion examples/gen_server/dlm/dlm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var _ = require("lodash"),
microtime = require("microtime"),
cl = require("../../../index"),
util = require("util"),
debug = require("debug")("clusterluck:examples:dlm");
debug = require("debug")("notp:examples:dlm");

var GenServer = cl.GenServer;
const mcsToMs = 1000;
Expand Down
28 changes: 14 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var consts = lib.consts;
* @return {Clusterluck.CHash} A consistent hash ring instance.
*
* @example
* let chash = clusterluck.createCHash(3, 2);
* let chash = notp.createCHash(3, 2);
* assert.equal(chash.rfactor(), 3);
* assert.equal(chash.pfactor(), 2);
*
Expand All @@ -42,7 +42,7 @@ function createCHash(rfactor = 3, pfactor = 2) {
* @return {Clusterluck.VectorClock} A vector clock instance.
*
* @example
* let vclock = clusterluck.createVClock();
* let vclock = notp.createVClock();
* assert.equal(vclock.size(), 0);
* vclock = clutserluck.createVClock("id", 1);
* assert.equal(vclock.size(), 1);
Expand All @@ -67,14 +67,14 @@ function createVClock(id, count) {
* @param {Number} [opts.interval] - Interval to select a random node from the cluster and gossip the state of the ring with, with a granularity of milliseconds. Defaults to 1000.
* @param {Number} [opts.flushInterval] - Interval to flush the state of the ring to disk, with a granularity of milliseconds. Defaults to 1000.
* @param {String} [opts.flushPath] - Path string to flush the state of the ring to; if set to `null`, the gossip ring will just skip flushing state to disk. Defaults to `null`.
* @param {Object} [opts.vclockOpts] - Vector clock options for trimming; occurs at the same interval as `interval`. Defaults to `clusterluck.consts.vclockOpts`.
* @param {Object} [opts.vclockOpts] - Vector clock options for trimming; occurs at the same interval as `interval`. Defaults to `notp.consts.vclockOpts`.
* @param {Object} [opts.connOpts] - Connection options for when connecting to new nodes.
*
* @return {Clusterluck.GossipRing} A new gossip ring instance.
*
* @example
* // initializes gossip ring with defaults found in `clusterluck.consts.gossipOpts`
* let gossip = clusterluck.createGossip(kernel);
* // initializes gossip ring with defaults found in `notp.consts.gossipOpts`
* let gossip = notp.createGossip(kernel);
* assert.equal(gossip.ring().rfactor(), 3);
* assert.equal(gossip.ring().pfactor(), 2);
* assert.deepEqual(gossip.kernel(), kernel);
Expand Down Expand Up @@ -108,7 +108,7 @@ function createGossip(kernel, opts) {
* @return {Clusterluck.NetKernel} A new network kernel instance.
*
* @example
* let kernel = clusterluck.createKernel("foo", "localhost", 7022);
* let kernel = notp.createKernel("foo", "localhost", 7022);
* assert.equal(kernel.id(), "foo");
* assert.equal(kernel.host(), "localhost");
* assert.equal(kernel.port(), 7022);
Expand Down Expand Up @@ -140,7 +140,7 @@ function createKernel(id, host = os.hostname(), port = 7022, opts = {}) {
* @return {Clusterluck.CommandServer} A new command server instance.
*
* @example
* let comms = clusterluck.createCommServer(gossip, kernel);
* let comms = notp.createCommServer(gossip, kernel);
* assert.deepEqual(comms.gossip(), gossip);
* assert.deepEqual(comms.kernel(), kernel);
*
Expand All @@ -166,7 +166,7 @@ function createCommServer(gossip, kernel) {
* @return {Clusterluck.ClusterNode} A new cluster node instance.
*
* @example
* let node = clusterluck.createCluster("foo", "localhost", 7022);
* let node = notp.createCluster("foo", "localhost", 7022);
* assert.equal(node.kernel().id(), "foo");
* assert.equal(node.kernel().host(), "localhost");
* assert.equal(node.kernel().port(), 7022);
Expand Down Expand Up @@ -197,7 +197,7 @@ function createCluster(id, host = os.hostname(), port = 7022, opts = {}) {
* @return {Clusterluck.GenServer} A new generic server instance.
*
* @example
* let server = clusterluck.createGenServer(cluster);
* let server = notp.createGenServer(cluster);
* // based on how messages are parsed, will operate on event 'command_name' sent by another actor to this node
* server.on("command_name", handlerForCommand);
* // will listen on server.kernel() for messages emitted on event 'foo'.
Expand Down Expand Up @@ -229,7 +229,7 @@ function createGenServer(cluster, opts) {
* @return {Clusterluck.DTable} A new dtable instance.
*
* @example
* let table = clusterluck.createDTable({
* let table = notp.createDTable({
* path: "/path/to/dir",
* writeThreshold: 100,
* autoSave: 180000,
Expand All @@ -238,7 +238,7 @@ function createGenServer(cluster, opts) {
* table.start("foo");
*
* @example
* let table = clusterluck.createDTable({
* let table = notp.createDTable({
* path: "/path/to/dir",
* writeThreshold: 100,
* autoSave: 180000,
Expand Down Expand Up @@ -266,7 +266,7 @@ function createDTable(opts) {
* @return {Clusterluck.MTable} A new mtable instance.
*
* @example
* let table = clusterluck.createMTable();
* let table = notp.createMTable();
* table.start("foo");
*
*/
Expand Down Expand Up @@ -298,7 +298,7 @@ function createMTable() {
* @return {Clusterluck.DLMServer} A new generic server instance.
*
* @example
* let server = clusterluck.createDLM(cluster, {disk: true, path: "/path/to/dir"});
* let server = notp.createDLM(cluster, {disk: true, path: "/path/to/dir"});
* server.load((err) => {
* server.start("foo");
* });
Expand Down Expand Up @@ -331,7 +331,7 @@ function createDLM(cluster, opts) {
* @return {Clusterluck.DSMServer} A new generic server instance.
*
* @example
* let server = clusterluck.createDSM(cluster, {disk: true, path: "/path/to/dir"});
* let server = notp.createDSM(cluster, {disk: true, path: "/path/to/dir"});
* server.load((err) => {
* server.start("foo");
* });
Expand Down
2 changes: 1 addition & 1 deletion lib/chash.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const _ = require("lodash"),
debug = require("debug")("clusterluck:lib:chash"),
debug = require("debug")("notp:lib:chash"),
rbt = require("functional-red-black-tree"),
LRU = require("lru-cache"),
crypto = require("crypto"),
Expand Down
2 changes: 1 addition & 1 deletion lib/command_server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const _ = require("lodash"),
debug = require("debug")("clusterluck:lib:command_server");
debug = require("debug")("notp:lib:command_server");

const GenServer = require("./gen_server"),
NetKernel = require("./kernel"),
Expand Down
2 changes: 1 addition & 1 deletion lib/conn.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const _ = require("lodash"),
consts = require("./consts"),
debug = require("debug")("clusterluck:lib:conn"),
debug = require("debug")("notp:lib:conn"),
EventEmitter = require("events").EventEmitter,
Queue = require("./queue");

Expand Down
2 changes: 1 addition & 1 deletion lib/dlm/dlm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const _ = require("lodash"),
microtime = require("microtime"),
util = require("util"),
async = require("async"),
debug = require("debug")("clusterluck:lib:dlm");
debug = require("debug")("notp:lib:dlm");

const GenServer = require("../gen_server"),
DTable = require("../dtable"),
Expand Down
2 changes: 1 addition & 1 deletion lib/dsem/dsm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const _ = require("lodash"),
util = require("util"),
async = require("async"),
stream = require("stream"),
debug = require("debug")("clusterluck:lib:dsm");
debug = require("debug")("notp:lib:dsm");

const GenServer = require("../gen_server"),
DTable = require("../dtable"),
Expand Down
2 changes: 1 addition & 1 deletion lib/dtable.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const _ = require("lodash"),
fs = require("fs"),
util = require("util"),
debug = require("debug")("clusterluck:lib:dtable"),
debug = require("debug")("notp:lib:dtable"),
async = require("async"),
path = require("path"),
shortid = require("shortid"),
Expand Down
4 changes: 2 additions & 2 deletions lib/gen_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const _ = require("lodash"),
stream = require("stream"),
util = require("util"),
utils = require("./utils"),
debug = require("debug")("clusterluck:lib:gen_server");
debug = require("debug")("notp:lib:gen_server");

class GenServer extends EventEmitter {
/**
*
* Generic server implementation. Basic unit of logic handling in clusterluck. Provides the ability to send/receive messages across a cluster using `call`, `cast`, `multicall`, and `abcast`. Largely derived from Erlang's gen_server model, but incorporated into node.js' EventEmitter model. Internally, message streams are memoized until finished, which then triggers the firing of an event for given event (say we're listening for event "hello", if this server receives a message stream with event "hello", we'll fire it under the hood). In addition to message streams, message singletons are supported, which are message streams with a singleton message and bypass any stream memoization.
* Generic server implementation. Basic unit of logic handling in notp. Provides the ability to send/receive messages across a cluster using `call`, `cast`, `multicall`, and `abcast`. Largely derived from Erlang's gen_server model, but incorporated into node.js' EventEmitter model. Internally, message streams are memoized until finished, which then triggers the firing of an event for given event (say we're listening for event "hello", if this server receives a message stream with event "hello", we'll fire it under the hood). In addition to message streams, message singletons are supported, which are message streams with a singleton message and bypass any stream memoization.
*
* Think of it like event emitters that are targetable across a cluster, as well as internal to a node.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/gossip.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const _ = require("lodash"),
microtime = require("microtime"),
fs = require("fs"),
util = require("util"),
debug = require("debug")("clusterluck:lib:gossip");
debug = require("debug")("notp:lib:gossip");

const GenServer = require("./gen_server"),
CHash = require("./chash"),
Expand Down
2 changes: 1 addition & 1 deletion lib/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const _ = require("lodash"),
stream = require("stream"),
crypto = require("crypto"),
util = require("util"),
debug = require("debug")("clusterluck:lib:kernel");
debug = require("debug")("notp:lib:kernel");

const Node = require("./node"),
consts = require("./consts"),
Expand Down
2 changes: 1 addition & 1 deletion lib/mtable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const _ = require("lodash"),
debug = require("debug")("clusterluck:lib:mtable"),
debug = require("debug")("notp:lib:mtable"),
async = require("async"),
shortid = require("shortid"),
EventEmitter = require("events").EventEmitter;
Expand Down
2 changes: 1 addition & 1 deletion lib/node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var _ = require("lodash"),
debug = require("debug")("clusterluck:lib:node");
debug = require("debug")("notp:lib:node");

class Node {
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/vclock.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var _ = require("lodash"),
async = require("async"),
microtime = require("microtime"),
assert = require("assert"),
debug = require("debug")("clusterluck:lib:vclock");
debug = require("debug")("notp:lib:vclock");

var utils = require("./utils");

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "clusterluck",
"name": "notp",
"version": "2.0.0",
"description": "Distributed systems library for gossip protocols, consistent hash rings, and vector clocks.",
"main": "index.js",
Expand All @@ -9,15 +9,15 @@
},
"repository": {
"type": "git",
"url": "https://github.com/azuqua/clusterluck.git"
"url": "https://github.com/azuqua/notp.git"
},
"engines": {
"node": ">=6.9.1"
},
"author": "Kevin Wilson <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/azuqua/clusterluck/issues"
"url": "https://github.com/azuqua/notp/issues"
},
"keywords": [
"consistent hashing",
Expand All @@ -34,7 +34,7 @@
"bin": {
"ncl": "./bin/cli.js"
},
"homepage": "https://github.com/azuqua/clusterluck",
"homepage": "https://github.com/azuqua/notp",
"dependencies": {
"async": "^1.5.2",
"debug": "^2.2.0",
Expand Down

0 comments on commit 52795fe

Please sign in to comment.