aaronharder / node_cpdb Goto Github PK
View Code? Open in Web Editor NEWThis project forked from marook/node_cpdb
crazy pili's data base for node.js
License: GNU General Public License v3.0
This project forked from marook/node_cpdb
crazy pili's data base for node.js
License: GNU General Public License v3.0
cpdb - crazy pili's database 1) Introduction 2) Features 3) Requirements 4) Example Code 5) Maintenance 6) Tests 7) Contact --------------------------------------------------------------------------- Introduction cpdb is a NoSQL database for node.js. --------------------------------------------------------------------------- Features * Stores key / values pairs persistent in the file system * Supports transactions * Generate unique keys --------------------------------------------------------------------------- Requirements * DB keys must be strings * DB values must be serializable using JSON.stringify and JSON.parse --------------------------------------------------------------------------- Example Code Here's some example code which stores values in a database: var db = require('cpdb').DB('path/to/my/db/directory'); var trans = db.newTransaction(); trans.set('key', { value: 'hello world!' }); if(somethingWentReallyBad){ trans.rollback(); } else{ trans.commit(function(){ // success console.log('Data stored'); }, function(e){ // error console.log('Error: ' + e); }); } And some more code which retrieves values from the database: var db = require('cpdb').DB('path/to/my/db/directory'); var readOnly = true; var trans = db.newTransaction(readOnly); trans.get('key', function(data){ // success if(data === undefined){ console.log('Nothing stored in DB'); } else{ console.log('Got ' + data); } }, function(e){ // error console.log('Error: ' + e); }); --------------------------------------------------------------------------- Maintenance The database uses some temporary files and folders for implementing transactions. Sometimes these transaction data is not delete correctly. It is safe to manually clear the transaction data when all database instances are shut down. To clear the transaction data remove the transactions directory below your database directory. --------------------------------------------------------------------------- Tests Execute the tests using make: $ make test --------------------------------------------------------------------------- Contact * Markus Pielmeier <[email protected]>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.