[Pkg-javascript-commits] [node-leveldown] 212/492: Merge remote-tracking branch 'levelup/master' into 0.1-wip
Andrew Kelley
andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:14:00 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 f981d07332873b280d01dad5efcc5274b294fde6
Merge: eb4c041 c0224d0
Author: Rod Vagg <rod at vagg.org>
Date: Sat Feb 16 11:27:20 2013 +1100
Merge remote-tracking branch 'levelup/master' into 0.1-wip
Conflicts:
src/async.h
src/batch.cc
src/database.cc
src/iterator.cc
src/iterator.h
src/iterator_async.cc
src/iterator_async.h
src/levelup.cc
src/levelup.h
src/database.cc | 55 +++++++++++++++----------
src/iterator.cc | 108 +++++++++++++++++++++++++-------------------------
src/iterator.h | 24 +++++------
src/iterator_async.cc | 22 +++++-----
src/iterator_async.h | 16 ++++----
5 files changed, 119 insertions(+), 106 deletions(-)
diff --cc src/database.cc
index b9fd4fb,3e3b648..26680d1
--- a/src/database.cc
+++ b/src/database.cc
@@@ -27,15 -26,20 +27,22 @@@ Database::~Database ()
delete db;
};
+const char* Database::Location() const { return location; }
+
/* Calls from worker threads, NO V8 HERE *****************************/
- Status Database::OpenDatabase (Options* options, string location) {
- return DB::Open(*options, location, &db);
+ leveldb::Status Database::OpenDatabase (
+ leveldb::Options* options
+ , std::string location
+ ) {
+ return leveldb::DB::Open(*options, location, &db);
}
- Status Database::PutToDatabase (WriteOptions* options, Slice key, Slice value) {
+ leveldb::Status Database::PutToDatabase (
+ leveldb::WriteOptions* options
+ , leveldb::Slice key
+ , leveldb::Slice value
+ ) {
return db->Put(*options, key, value);
}
@@@ -115,49 -127,36 +130,49 @@@ void Database::Init ()
);
tpl->PrototypeTemplate()->Set(
v8::String::NewSymbol("approximateSize")
- , FunctionTemplate::New(ApproximateSize)->GetFunction()
+ , v8::FunctionTemplate::New(ApproximateSize)->GetFunction()
);
- constructor = v8::Persistent<Function>::New(tpl->GetFunction());
+ constructor = v8::Persistent<v8::Function>::New(tpl->GetFunction());
}
- v8::Handle<Value> Database::New (const v8::Arguments& args) {
+ v8::Handle<v8::Value> Database::New (const v8::Arguments& args) {
v8::HandleScope scope;
- Database* obj = new Database();
+ if (args.Length() == 0) {
+ THROW_RETURN("leveldown() requires at least a location argument")
+ }
+
+ if (!args[0]->IsString()) {
+ THROW_RETURN("leveldown() requires a location string argument")
+ }
+
+ FROM_V8_STRING(location, Handle<String>::Cast(args[0]))
+
+ Database* obj = new Database(location);
obj->Wrap(args.This());
return args.This();
}
- v8::Handle<Value> Database::NewInstance (const v8::Arguments& args) {
+ v8::Handle<v8::Value> Database::NewInstance (const v8::Arguments& args) {
v8::HandleScope scope;
- v8::Handle<v8::Value> argv[0];
- v8::Local<v8::Object> instance = constructor->NewInstance(0, argv);
+ v8::Handle<v8::Value> argv[args.Length()];
+
+ for (int i = 0; i < args.Length(); i++)
+ argv[i] = args[i];
+
+ v8::Local<v8::Object> instance = constructor->NewInstance(args.Length(), argv);
return scope.Close(instance);
}
- v8::Handle<Value> Database::Open (const v8::Arguments& args) {
+ v8::Handle<v8::Value> Database::Open (const v8::Arguments& args) {
v8::HandleScope scope;
- Database* database = node::ObjectWrap::Unwrap<Database>(args.This());
- v8::String::Utf8Value location(args[0]->ToString());
- v8::Local<v8::Object> optionsObj = v8::Local<v8::Object>::Cast(args[1]);
- BOOLEAN_OPTION_VALUE(optionsObj, createIfMissing)
+ METHOD_SETUP_COMMON(open, 0, 1)
+
+ BOOLEAN_OPTION_VALUE_DEFTRUE(optionsObj, createIfMissing)
BOOLEAN_OPTION_VALUE(optionsObj, errorIfExists)
BOOLEAN_OPTION_VALUE(optionsObj, compression)
UINT32_OPTION_VALUE(optionsObj, cacheSize, 8 << 20)
@@@ -176,10 -177,13 +191,10 @@@
return v8::Undefined();
}
- v8::Handle<Value> Database::Close (const v8::Arguments& args) {
+ v8::Handle<v8::Value> Database::Close (const v8::Arguments& args) {
v8::HandleScope scope;
- Database* database = node::ObjectWrap::Unwrap<Database>(args.This());
- v8::Persistent<v8::Function> callback;
- if (args.Length() > 0)
- callback = v8::Persistent<v8::Function>::New(v8::Local<v8::Function>::Cast(args[0]));
+ METHOD_SETUP_COMMON_ONEARG(close)
CloseWorker* worker = new CloseWorker(database, callback);
AsyncQueueWorker(worker);
@@@ -246,12 -250,12 +261,12 @@@ v8::Handle<v8::Value> Database::Get (co
return v8::Undefined();
}
- v8::Handle<Value> Database::Delete (const v8::Arguments& args) {
+ v8::Handle<v8::Value> Database::Delete (const v8::Arguments& args) {
v8::HandleScope scope;
- Database* database = node::ObjectWrap::Unwrap<Database>(args.This());
- v8::Persistent<v8::Function> callback =
- v8::Persistent<v8::Function>::New(v8::Local<v8::Function>::Cast(args[2]));
+ Database* database = ObjectWrap::Unwrap<Database>(args.This());
+ Persistent<Function> callback =
+ Persistent<Function>::New(Local<Function>::Cast(args[2]));
CB_ERR_IF_NULL_OR_UNDEFINED(0, "Key")
diff --cc src/iterator.cc
index 941842d,4734383..0d71880
--- a/src/iterator.cc
+++ b/src/iterator.cc
@@@ -10,12 -10,9 +10,9 @@@
#include "iterator.h"
#include "iterator_async.h"
- using namespace std;
- using namespace v8;
- using namespace node;
- using namespace leveldown;
-namespace levelup {
++namespace leveldown {
- bool leveldown::Iterator::GetIterator () {
+ bool Iterator::GetIterator () {
if (dbIterator == NULL) {
dbIterator = database->NewIterator(options);
if (start != NULL)
@@@ -203,7 -203,9 +203,9 @@@ v8::Handle<v8::Value> Iterator::New (co
return args.This();
}
- Handle<Value> leveldown::CreateIterator (const Arguments& args) {
- HandleScope scope;
- return scope.Close(leveldown::Iterator::NewInstance(args));
+ v8::Handle<v8::Value> CreateIterator (const v8::Arguments& args) {
+ v8::HandleScope scope;
+ return scope.Close(Iterator::NewInstance(args));
}
+
-} // namespace levelup
++} // namespace leveldown
diff --cc src/iterator.h
index e12d96b,e9868a2..6ce0af0
--- a/src/iterator.h
+++ b/src/iterator.h
@@@ -12,11 -12,7 +12,7 @@@
#include "database.h"
#include "async.h"
- using namespace std;
- using namespace v8;
- using namespace leveldb;
-
-namespace levelup {
+namespace leveldown {
LU_OPTION ( start );
LU_OPTION ( end );
@@@ -105,6 -101,6 +101,6 @@@ private
LU_V8_METHOD( End )
};
- };
-} // namespace levelup
++} // namespace leveldown
#endif
diff --cc src/iterator_async.cc
index 365bcda,d053e57..7c15b7b
--- a/src/iterator_async.cc
+++ b/src/iterator_async.cc
@@@ -11,7 -11,7 +11,7 @@@
#include "async.h"
#include "iterator_async.h"
--namespace levelup {
++namespace leveldown {
/** NEXT WORKER **/
@@@ -85,4 -85,4 +85,4 @@@ void EndWorker::Execute ()
iterator->IteratorEnd();
}
--} // namespace levelup
++} // namespace leveldown
diff --cc src/iterator_async.h
index 84eb160,43b51a9..731a7b8
--- a/src/iterator_async.h
+++ b/src/iterator_async.h
@@@ -11,7 -11,7 +11,7 @@@
#include "async.h"
#include "iterator.h"
--namespace levelup {
++namespace leveldown {
class NextWorker : public AsyncWorker {
public:
@@@ -46,9 -46,9 +46,9 @@@ public
virtual void Execute ();
private:
- leveldown::Iterator* iterator;
+ Iterator* iterator;
};
--} // namespace levelup
++} // namespace leveldown
#endif
--
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