[Pkg-javascript-commits] [node-leveldown] 47/492: code cleanup
Andrew Kelley
andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:43 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 1bf455b0ba28e08a41694c0ad617683cb638b27f
Author: Rod Vagg <rod at vagg.org>
Date: Sat Sep 22 14:24:11 2012 +1000
code cleanup
---
src/database.cc | 41 +---------------------------------------
src/database_async.cc | 52 ---------------------------------------------------
2 files changed, 1 insertion(+), 92 deletions(-)
diff --git a/src/database.cc b/src/database.cc
index 09f1055..d123ef1 100644
--- a/src/database.cc
+++ b/src/database.cc
@@ -75,14 +75,13 @@ Persistent<Function> Database::constructor;
void Database::Init () {
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("Database"));
- tpl->InstanceTemplate()->SetInternalFieldCount(7);
+ tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->PrototypeTemplate()->Set(String::NewSymbol("open") , FunctionTemplate::New(Open)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("close") , FunctionTemplate::New(Close)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("put") , FunctionTemplate::New(Put)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("get") , FunctionTemplate::New(Get)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("del") , FunctionTemplate::New(Delete)->GetFunction());
tpl->PrototypeTemplate()->Set(String::NewSymbol("batch") , FunctionTemplate::New(Batch)->GetFunction());
-// tpl->PrototypeTemplate()->Set(String::NewSymbol("iterator") , FunctionTemplate::New(Iterator)->GetFunction());
constructor = Persistent<Function>::New(tpl->GetFunction());
}
@@ -248,44 +247,6 @@ Handle<Value> Database::Batch (const Arguments& args) {
return Undefined();
}
-/*
-Handle<Value> Database::Iterator (const Arguments& args) {
- HandleScope scope;
-
- cout << "Database::Iterator" << endl;
-
- Database* database = ObjectWrap::Unwrap<Database>(args.This());
- Persistent<Function> dataCallback = Persistent<Function>::New(Local<Function>::Cast(args[0]));
- Persistent<Function> callback = Persistent<Function>::New(Local<Function>::Cast(args[1]));
-
- cout << "Database::Iterator making worker" << endl;
-
- levelup::Iterator iterator = new Iterator(
- this
- , callback
- , dataCallback
- , NULL
- , NULL
- );
-*/
-/*
- IteratorWorker* worker = new IteratorWorker(
- database
- , callback
- , dataCallback
- , NULL
- , NULL
- );
-
- cout << "Queueing iterator worker..." << endl;
-
- AsyncQueueWorker(worker);
-*/
-/*
- return Undefined();
-}
-*/
-
Handle<Value> CreateDatabase (const Arguments& args) {
HandleScope scope;
return scope.Close(Database::NewInstance(args));
diff --git a/src/database_async.cc b/src/database_async.cc
index 5076929..7ab232a 100644
--- a/src/database_async.cc
+++ b/src/database_async.cc
@@ -99,55 +99,3 @@ void BatchWorker::Execute () {
operations[i]->Execute(&batch);
status = database->WriteBatchToDatabase(options, &batch);
}
-/*
-IteratorWorker::~IteratorWorker () {
- delete options;
-}
-
-struct IteratorCallbackChunk {
- Persistent<Function> callback;
- Buffer* key;
- Buffer* value;
- uv_async_t async;
-};
-
-void dataCallbackProxy (void* ctx, Slice key, Slice value) {
- IteratorWorker* worker = static_cast<IteratorWorker*>(ctx);
- worker->DataCallback(key, value);
-}
-
-void handleDataCallback(uv_async_t *handle, int status) {
-cout<<"handleDataCallback..." << endl;
- IteratorCallbackChunk *chunk = static_cast<IteratorCallbackChunk*>(handle->data);
- uv_close((uv_handle_t*) &chunk->async, NULL); // necessary otherwise UV will block
- */
- /*
- baton->callback->Call(v8::Context::GetCurrent()->Global(), 1, argv); // call the JS callback method as usual
- baton->callback.Dispose(); // delete the baton
- baton->data.Dispose();
- */
-/* delete chunk;
-}
-
- */
-/*
-void IteratorWorker::DataCallback (Slice key, Slice value) {
- cout << "IT cb: " << key.ToString() << " = " << value.ToString() << endl;
-
- IteratorCallbackChunk* work = new IteratorCallbackChunk();
- work->async.data = work;
- work->callback = dataCallback;
- work->key = Buffer::New((char*)key.data(), key.size());
- work->value = Buffer::New((char*)value.data(), value.size());
-cout<<"uv_async_send..." << endl;
- uv_async_init(uv_default_loop(), &work->async, handleDataCallback); // tell UV to call After_cb() async
- uv_async_send(&work->async);
-}
-
-void IteratorWorker::Execute () {
-//Status Database::Iterator (ReadOptions* options, Slice start, Slice end, void (*callback)(Slice key, Slice value)) {
-
-cout<< "IT execute" << endl;
- status = database->Iterator(options, start, end, this, &dataCallbackProxy);
-}
-*/
--
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