Permalink
Browse files

Refactor to use proper header and source files

  • Loading branch information...
1 parent 8d98463 commit e66e04d93c65d62cc94882fb88b28725fdac6ca2 @carter-thaxton carter-thaxton committed Jun 3, 2011
Showing with 479 additions and 487 deletions.
  1. +1 −0 .gitignore
  2. +0 −31 dumpdata.cc
  3. +0 −19 index.cc
  4. +165 −170 src/DB.cc
  5. +48 −0 src/DB.h
  6. +22 −37 src/Iterator.cc
  7. +24 −0 src/Iterator.h
  8. +56 −64 src/WriteBatch.cc
  9. +36 −0 src/WriteBatch.h
  10. +82 −0 src/helpers.cc
  11. +15 −81 src/helpers.h
  12. +16 −0 src/leveldb.cc
  13. +0 −66 src/node_leveldb.h
  14. +14 −19 wscript
View
@@ -4,3 +4,4 @@
deps/leveldb/*_test
deps/leveldb/db_bench
build
+demo/testdb
View
@@ -1,31 +0,0 @@
-#include <iostream>
-#include "leveldb/db.h"
-
-using namespace std;
-
-int main(int argc, char** argv) {
- leveldb::DB* db;
- leveldb::Options options;
- if (argc < 2) {
- cerr << "Usage:\n\t" << argv[0] << " path/to/database\n";
- return 1;
- }
- cout << "Opening database at " << argv[1] << endl;
- leveldb::Status status = leveldb::DB::Open(options, argv[1], &db);
- if (!status.ok()) {
- cerr << status.ToString() << endl;
- return 1;
- }
- cout << "--------------------------------------------------------------------------------" << endl;
- leveldb::Iterator* it = db->NewIterator(leveldb::ReadOptions());
- for (it->SeekToFirst(); it->Valid(); it->Next()) {
- cout << it->key().ToString() << ": " << it->value().ToString() << endl;
- }
- if (!it->status().ok()) {
- cerr << it->status().ToString() << endl;
- return 1;
- }
- delete it;
- cout << "--------------------------------------------------------------------------------" << endl;
- delete db;
-}
View
@@ -1,19 +0,0 @@
-#include "src/DB.cc"
-#include "src/WriteBatch.cc"
-#include "src/Iterator.cc"
-
-using namespace node_leveldb;
-
-v8::Persistent<FunctionTemplate> DB::persistent_function_template;
-v8::Persistent<FunctionTemplate> WriteBatch::persistent_function_template;
-v8::Persistent<FunctionTemplate> Iterator::persistent_function_template;
-
-extern "C" {
- static void init(Handle<Object> target) {
- DB::Init(target);
- WriteBatch::Init(target);
- Iterator::Init(target);
- }
- NODE_MODULE(leveldb, init);
-}
-
Oops, something went wrong.

0 comments on commit e66e04d

Please sign in to comment.