Skip to content
This repository has been archived by the owner on Sep 19, 2019. It is now read-only.

Commit

Permalink
Merge pull request #22 from boplish/chord
Browse files Browse the repository at this point in the history
refs #4 Add Chord implementation
  • Loading branch information
chris-- committed Mar 18, 2014
2 parents 316164f + 792d0d0 commit 30fcea5
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
35 changes: 35 additions & 0 deletions js/chord/chord.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
var Chord = function() {
// TODO: implement, initialize node ID
};

/**
* join the DHT by using the 'bootstrap' DataChannel
*
* @param bootstrap DataChannel connection of bootstrap host
*/
Chord.prototype.join = function(bootstrap) {
// TODO: implement
};

/**
* Store 'value' under 'key' in the DHT
*
* @param key
* @param value
*/
Chord.prototype.put = function(key, value) {
// TODO: implement
};

Chord.prototype.remove = function(key) {
// TODO: implement
};

Chord.prototype.get = function(key) {
// TODO: implement
};


if (typeof(module) !== 'undefined') {
module.exports = Chord;
}
30 changes: 30 additions & 0 deletions js/chord/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var Node = function(id, dc) {
if (!(this instanceof Node)) {
return new Node();
}

this.finger_table = [];

return this;

};

Node.prototype = {

message_types: {
GET_SUCCESSOR: 0,
FIND_SUCCESSOR: 1,
FIND_PREDECESSOR: 2,
FIND_CLOSEST_PRECEDING_FINGER: 3,
},

find_successor: function (id) {
},


};


if (typeof(module) !== 'undefined') {
module.exports = Node;
}

0 comments on commit 30fcea5

Please sign in to comment.