New: Introducing PHP and Composer Support.Read the Announcement
Socket
Book a DemoInstallSign in
Socket

scurry

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scurry

A leveldb-backed consistent hash ring, for your toy caching needs.

Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
5
150%
Maintainers
1
Weekly downloads
 
Created
Source

scurry

A leveldb-backed consistent hash ring, for your toy caching needs. Seriously unfinished; do not put data in this. No really, don't.

One part each

Rod Vagg's levelup leveldb bindings for node + sublevel to create buckets.

Dominic Tarr's crtd, which uses his scuttlebutt implementation to keep a document in sync.

light-cycle, a lightweight consistent hash ring structure that can be mixed into most anything.

restify to provide a simple RESTful api to data in the buckets.

Shake with ice

Run a server:

node index.js --id=node-one -s -p 3333 -g 4114 -d ./db | ./node_modules/.bin/bunyan -o short

Run a client or five:

node index.js --id=node-two -p 3334 -g 4114 -h 10.0.0.5 -d ./db2 | ./node_modules/.bin/bunyan -o short
node index.js --id=node-three -p 3335 -g 4114 -h 10.0.0.5 -d ./db3 | ./node_modules/.bin/bunyan -o short`
node index.js --id=node-four -p 3336 -g 4114 -h 10.0.0.5 -d ./db4 | ./node_modules/.bin/bunyan -o short

Replace 10.0.0.5 with the IP address of your server.

Strain into a chilled glass

Then stuff some data in:

http -f PUT 10.0.0.5:3334/vodkas/1 name="Sobieski" rating=5
http -f PUT 10.0.0.5:3335/vodkas/2 name="Tito's Handmade" rating=5

Get it back out: http GET 10.0.0.5:3336/vodkas/2

(Human-friendly shell commands courtesy of httpie.)

TODO

  • The RESTful server is a mess.
  • Need to pay attention to content encodings & store them with the documents as metadata.
  • Implement key streaming from multiple nodes. See notes in endpoints.handleGetBucket().
  • Reconnect on errors.
  • Clean up configuration & options.
  • Create directories for dbs if they don't exist.
  • Error handling.
  • Better logging.
  • Light-cycle is rickety; bullet-proof it.
  • Stretch goal: replication?

Keywords

leveldb

FAQs

Package last updated on 14 Jul 2013

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