Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-lmdb

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-lmdb - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

libraries/liblmdb/CHANGES

48

example-advanced1-indexing.js

@@ -19,3 +19,3 @@

var lmdb, env, dbi;
// initializer function, call this before using the index

@@ -29,3 +29,3 @@ var init = function() {

});
dbi = env.openDbi({

@@ -37,3 +37,3 @@ name: "example-advanced-indexing",

};
// destroy function, call this when you no longer need the index

@@ -44,3 +44,3 @@ var destroy = function() {

};
// simple tokenizer

@@ -53,3 +53,3 @@ var tokenize = function(document) {

var splitted = stripped.split(" ");
for (var j = splitted.length; j--; ) {

@@ -64,3 +64,3 @@ if (splitted[j] !== '' && tokens.indexOf(splitted[j]) === -1) {

};
// adds a document to the index

@@ -71,6 +71,6 @@ var addDocument = function(document) {

}
var tokens = tokenize(document);
var txn = env.beginTxn();
for (var i = tokens.length; i--; ) {

@@ -80,6 +80,6 @@ //console.log(tokens[i], document.id);

}
txn.commit();
};
// adds multiple documents to the index

@@ -90,3 +90,3 @@ var addDocuments = function(array) {

}
for (var i = array.length; i--; ) {

@@ -96,3 +96,3 @@ addDocument(array[i]);

};
// performs a search in the index for the given word

@@ -104,15 +104,16 @@ var searchForDocuments = function(str) {

var results = [];
try {
var shouldContinue = true;
cursor.goToRange(str);
while (shouldContinue) {
shouldContinue = cursor.getCurrentNumber(function(key, data) {
cursor.getCurrentNumber(function(key, data) {
//console.log(key.length, str.length, key == str);
if (key !== str)
return false;
results.push(data);
return true;
if (key !== str) {
shouldContinue = false;
}
else {
results.push(data);
}
});

@@ -126,9 +127,9 @@ cursor.goToNext();

}
cursor.close();
txn.abort();
return results;
};
// The object we return here is the public API of the indexing engine

@@ -178,2 +179,1 @@ return Object.freeze({

indexingEngine.destroy();

@@ -13,5 +13,5 @@ {

"repository": "https://github.com/Venemo/node-lmdb",
"version": "0.1.1",
"version": "0.2.0",
"main": "./build/Release/node-lmdb",
"gypfile": true
}

@@ -52,3 +52,3 @@ node-lmdb

env.open({
path: __dirname + "/mydata",
path: __dirname + "/mydata",
mapSize: 2*1024*1024*1024, // maximum database size

@@ -84,8 +84,8 @@ maxDbs: 3

The basic unit of work in LMDB is a transaction, which is called `Txn` for short. Here is how you operate with your data.
Every piece of data in LMDB is referred to by a **key**.
The basic unit of work in LMDB is a transaction, which is called `Txn` for short. Here is how you operate with your data.
Every piece of data in LMDB is referred to by a **key**.
You can use the methods `getString()`, `getBinary()`, `getNumber()` and `getBoolean()` to retrieve something,
`putString()`, `putBinary()`, `putNumber()` and `putBoolean()` to store something and `del()` to delete something.
Currently **only string, binary, number and boolean values are supported**, use `JSON.stringify` and `JSON.parse` for complex data structures.
Currently **only string, binary, number and boolean values are supported**, use `JSON.stringify` and `JSON.parse` for complex data structures.
Because of the nature of LMDB, the data returned by `txn.getString()` and `txn.getBinary()` is only valid until the next `put` operation or the end of the transaction.

@@ -140,2 +140,4 @@ If you need to use the data *later*, you will have to copy it for yourself.

* `example5-dupsort.js` - shows how to use a `dupSort` database with cursors
* `example6-asyncio.js` - shows how to use the fastest (but also most dangerous) way for async IO
* `example7-largedb.js` - shows how to work with an insanely large database

@@ -158,3 +160,3 @@ Advanced examples:

If you find problems with this module, open an issue on GitHub.
If you find problems with this module, open an issue on GitHub.
Also feel free to send me pull requests. Contributions are more than welcome! :)

@@ -179,4 +181,15 @@

**Important:** this module is tested on Linux and Mac. Windows version is coming soon!
### Managing the LMDB dependency
```bash
# Adding upstream LMDB as remote
git remote add lmdb git@gitorious.org:mdb/mdb.git
# Fetch new remote
git fetch lmdb
# Adding the subtree (when it's not there yet)
git subtree add --prefix=dependencies/lmdb lmdb HEAD --squash
# Updating the subtree (when already added)
git subtree pull --prefix=dependencies/lmdb lmdb HEAD --squash
```
### Developer FAQ

@@ -194,3 +207,3 @@

Unfortunately, writing C++ addons to Node.js (and V8) requires a special pattern (as described in their docs) which most developers might find ugly.
Unfortunately, writing C++ addons to Node.js (and V8) requires a special pattern (as described in their docs) which most developers might find ugly.
Fortunately, we've done this work for you so you can enjoy LMDB without the need to code C++.

@@ -211,4 +224,1 @@

* LMDB documentation: http://symas.com/mdb/doc/

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc