npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dldb

v0.4.0

Published

Cloud Delay Line Memory Database

Downloads

24

Readme

dldb

This is a proof of concept REST backend for a cloud based Delay Line Memory database.

This database is like a memory database, but instead of memory, it transmits the data to another node over the network in an infinite loop and does not save the data locally.

Essentially the data is in the network data stream between the nodes.

It...

  • does not save state of data anywhere on the computer running the node
  • When there are no nodes waiting for data, automatically selects the slowest link on average
  • In case of a shutdown of a single node, it tries to make sure all active requests have been served (eg. the data is on another node)
  • Can notify other nodes about a desire to read or write data

Installing the backend

The bundled compiled backend does not have installable dependencies except Node v14 LTS and NPM command.

Clone it from Github using git clone https://github.com/sendanor/dldb.git dldb and start the node using command npm start.

...or install it from the NPM: npm install dldb and start the node using dldbd command.

Building the node backend

Building is not strictly necessary, since the git repository includes already compiled dist directory.

$ npm install
$ npm run build

Generate a secret

$ echo -n 'Secret1234'|shasum -a 512
9006d55d6e812ca3cf599dd70bf7142bddc4077553caafc505cb609edbc6e48bd86acf76b52e5903a125950dfedd70c32144bd59adcd798f3a504dc3c7bc37e9  -

Start nodes

Start the first node:

$ DLDB_INCOMING_SECRET='9006d55d6e812ca3cf599dd70bf7142bddc4077553caafc505cb609edbc6e48bd86acf76b52e5903a125950dfedd70c32144bd59adcd798f3a504dc3c7bc37e9' \
DLDB_PORT=3000 \
DLDB_NODES='http://localhost:3001' \
npm start

Start the second node:

$ DLDB_INCOMING_SECRET='9006d55d6e812ca3cf599dd70bf7142bddc4077553caafc505cb609edbc6e48bd86acf76b52e5903a125950dfedd70c32144bd59adcd798f3a504dc3c7bc37e9' \
DLDB_PORT=3001 \
DLDB_NODES='http://localhost:3000' \
npm start

Start database loop for resource 74766E7B-D41A-4A95-8C01-A28213B0C84A

$ curl -i -X POST 'http://localhost:3000/d/74766E7B-D41A-4A95-8C01-A28213B0C84A' -d '{"secret": "Secret1234", "payload":{"hello":"world"}, "level": 1, "from": "http://localhost:3001"}'
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sat, 14 Nov 2020 21:17:05 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 20

{
  "status": "OK"
}

You should not start it multiple times :)

Read database record

$ curl -i -X GET http://localhost:3000/74766E7B-D41A-4A95-8C01-A28213B0C84A
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sat, 14 Nov 2020 21:17:58 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 43

{
  "payload": {
    "hello": "world"
  }
}

Change the record

$ curl -i -X POST -d '{"foo":1234}' http://localhost:3000/74766E7B-D41A-4A95-8C01-A28213B0C84A
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sat, 14 Nov 2020 21:18:37 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 60

{
  "payload": {
    "hello": "world",
    "foo": 1234
  }
}

The public hostname (DLDB_PUBLIC_HOST)

The address which other nodes can use to connect to this node.

This is localhost:{DLDB_PORT} by default.

The public URL (DLDB_PUBLIC_URL)

The public URL which other nodes can use to connect to this node.

This is http://{DLDB_PUBLIC_HOST} by default.

The default listening hostname (DLDB_HOSTNAME)

The default listening hostname is 0.0.0.0, eg. every interface on the system.

The default listening port (DLDB_PORT)

Default port is 3000 and can be changed using DLDB_PORT environment variable.

Changing the node delay (DLDB_SEND_DELAY)

If no nodes have requested data, by default the operating node will wait for a 300 ms until sending the data to another node, so that you don't accidentally nuke your system.

You may change the delay by changing DLDB_SEND_DELAY environment variable.