[Pkg-javascript-commits] [node-leveldown] 128/492: minor code cleanup
Andrew Kelley
andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:51 UTC 2014
This is an automated email from the git hooks/post-receive script.
andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.
commit c2f079b16d46b1fae8fad9b9b1701678fd1c5142
Author: Rod Vagg <rod at vagg.org>
Date: Tue Dec 18 08:17:58 2012 +1100
minor code cleanup
---
lib/levelup.js | 2 +-
src/async.h | 2 +-
src/database.cc | 25 ++++++++-----------------
src/database.h | 12 +++++++++++-
src/iterator.cc | 2 +-
5 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/lib/levelup.js b/lib/levelup.js
index e48547a..e854e39 100644
--- a/lib/levelup.js
+++ b/lib/levelup.js
@@ -328,4 +328,4 @@ module.exports = function (location, options, callback) {
return levelup
}
-module.exports.copy = require('./util').copy
+module.exports.copy = require('./util').copy
\ No newline at end of file
diff --git a/src/async.h b/src/async.h
index c683d3b..85d926c 100644
--- a/src/async.h
+++ b/src/async.h
@@ -11,7 +11,7 @@ using namespace std;
using namespace v8;
using namespace leveldb;
-class AsyncWorker {
+/* abstract */ class AsyncWorker {
public:
AsyncWorker (
Database* database
diff --git a/src/database.cc b/src/database.cc
index a68a1c6..4900519 100644
--- a/src/database.cc
+++ b/src/database.cc
@@ -21,17 +21,6 @@ using namespace v8;
using namespace node;
using namespace leveldb;
-LU_OPTION ( createIfMissing ); // for open()
-LU_OPTION ( errorIfExists ); // for open()
-LU_OPTION ( compression ); // for open()
-LU_OPTION ( sync ); // for put() and delete()
-LU_OPTION ( asBuffer ); // for get()
-LU_STR ( key );
-LU_STR ( value );
-LU_STR ( type );
-LU_STR ( del );
-LU_STR ( put );
-
Database::Database () {
db = NULL;
};
@@ -41,7 +30,7 @@ Database::~Database () {
delete db;
};
-/* expect these to be called from worker threads, no v8 here */
+/* Calls from worker threads, NO V8 HERE *****************************/
Status Database::OpenDatabase (Options* options, string location) {
return DB::Open(*options, location, &db);
@@ -80,8 +69,15 @@ void Database::CloseDatabase () {
db = NULL;
}
+/* V8 exposed functions *****************************/
+
Persistent<Function> Database::constructor;
+Handle<Value> CreateDatabase (const Arguments& args) {
+ HandleScope scope;
+ return scope.Close(Database::NewInstance(args));
+}
+
void Database::Init () {
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("Database"));
@@ -273,8 +269,3 @@ Handle<Value> Database::Batch (const Arguments& args) {
return Undefined();
}
-
-Handle<Value> CreateDatabase (const Arguments& args) {
- HandleScope scope;
- return scope.Close(Database::NewInstance(args));
-}
diff --git a/src/database.h b/src/database.h
index 124a371..dc707cc 100644
--- a/src/database.h
+++ b/src/database.h
@@ -14,6 +14,17 @@ using namespace std;
using namespace v8;
using namespace leveldb;
+LU_OPTION ( createIfMissing ); // for open()
+LU_OPTION ( errorIfExists ); // for open()
+LU_OPTION ( compression ); // for open()
+LU_OPTION ( sync ); // for put() and delete()
+LU_OPTION ( asBuffer ); // for get()
+LU_STR ( key );
+LU_STR ( value );
+LU_STR ( type );
+LU_STR ( del );
+LU_STR ( put );
+
struct AsyncDescriptor;
Handle<Value> CreateDatabase (const Arguments& args);
@@ -48,7 +59,6 @@ private:
LU_V8_METHOD( Delete )
LU_V8_METHOD( Get )
LU_V8_METHOD( Batch )
-// LU_V8_METHOD( Iterator )
};
#endif
diff --git a/src/iterator.cc b/src/iterator.cc
index b37ed91..ac939e4 100644
--- a/src/iterator.cc
+++ b/src/iterator.cc
@@ -151,5 +151,5 @@ Handle<Value> levelup::Iterator::New (const Arguments& args) {
Handle<Value> levelup::CreateIterator (const Arguments& args) {
HandleScope scope;
- return scope.Close(levelup::Iterator::NewInstance(args));
+ return scope.Close(levelup::Iterator::NewInstance(args));
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git
More information about the Pkg-javascript-commits
mailing list