node-red-contrib-leveldb-ttl 0.0.3

Support for TTL, streams, batch - LevelDB database

npm install node-red-contrib-leveldb-ttl


06 Oct 2015 - node-red-contrib-leveldb-ttl

Install

Run the following command in the root directory of your Node-RED install

npm install node-red-contrib-leveldb-ttl

or

npm install git://github.com/min0n/node-red-contrib-leveldb-ttl.git

Usage

This is a quick and dirty Node-RED package to add Level-ttl support to the original node-red-node-leveldb code (version 0.0.5), and to wrap some Levelup functions, like batch and streams.

Use one node to either put (store) the msg.payload to the named database file, using msg.topic as the key, or to delete information select delete in the properties dialogue and again use msg.topic as the key..

Use the other node to get, or retrieve the data already saved in the database.

Again use msg.topic to hold the key for the database, and the result is returned in msg.payload. If nothing is found for the key then null is returned.

The configuration node allows to set the database Default TTLin seconds (0: disabled), and Scan TTL to set the internal scan in seconds. The Default TTL can be overriden.

The node to get from the database works as the original.

Some info about the new nodes:

Stream node: The configuration of this node defines the default type of stream: ReadStream, KeyStream or ValueStream. This can be overriden using msg.payload.keys and msg.payload.values. The range of keys that are streamed can be set by using msg.payload.start, msg.payload.end, msg.payload.lt, msg.payload.gt or msg.payload.limit. If no options are passed, it streams the entire database. Example: msg.payload = { keys: true, values: false, start: 'key1~', end: 'key1~~' }

Batch node: can be used for very fast bulk-write operations (both put and delete). msg.payload should contain a list of operations to be executed sequentially, although as a whole they are performed as an atomic operation inside LevelDB. Example: msg.payload =[ {type: 'put', key: 'key1', value: 123}, {type: 'del', key: 'key2'} ]

Batch2 node: This node get individuals operations and push them in a buffer before doing the batch operation to the database. The configuration of this node allows to set the buffer size.

KeyTTL node: This node can serve to insert or update a ttl for any given key from msg.topic in the database (even if that key doesn't exist but may in the future).

The configuration of the nodes to put, to batch and the keyttl node, include a Node TTL parameter to override the Default TTL. Also, Node TTL can be individually overriden by a msg.ttl.

Node Info

Version: 0.0.3
Updated 9 years, 2 months ago
License: Apache-2.0
Rating: not yet rated

Actions

Rate:

Downloads

8 in the last week

Nodes

  • leveldbttlbase
  • leveldb-ttl in
  • leveldb-ttl out
  • leveldb-ttl stream
  • leveldb-ttl stream2
  • leveldb-ttl keyttl
  • leveldb-ttl batchout
  • leveldb-ttl batchout2

Keywords

  • node-red
  • leveldb

Maintainers