Skip to content

Commit

Permalink
Rename binding functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphtheninja committed Dec 15, 2018
1 parent 1fba29c commit e37cda0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions leveldown.js
Expand Up @@ -16,14 +16,14 @@ function LevelDOWN (location) {
AbstractLevelDOWN.call(this)

this.location = location
this.dbContext = binding.leveldown()
this.context = binding.db()
}

util.inherits(LevelDOWN, AbstractLevelDOWN)

LevelDOWN.prototype._open = function (options, callback) {
binding.open(
this.dbContext,
binding.db_open(
this.context,
this.location,
options,
callback
Expand All @@ -43,8 +43,8 @@ LevelDOWN.prototype._serializeValue = function (value) {
}

LevelDOWN.prototype._put = function (key, value, options, callback) {
binding.put(
this.dbContext,
binding.db_put(
this.context,
key,
value,
options,
Expand Down
12 changes: 6 additions & 6 deletions napi/leveldown.cc
Expand Up @@ -37,7 +37,7 @@ static void FinalizeDbContext(napi_env env, void* data, void* hint) {
* Returns a context object for a database.
* E.g. `var dbContext = leveldown()`
*/
NAPI_METHOD(leveldown) {
NAPI_METHOD(db) {
DbContext* dbContext = new DbContext(env);

napi_value result;
Expand Down Expand Up @@ -230,7 +230,7 @@ struct OpenWorker : public BaseWorker {
/**
* Opens a database.
*/
NAPI_METHOD(open) {
NAPI_METHOD(db_open) {
NAPI_ARGV(4);
NAPI_DB_CONTEXT();
NAPI_ARGV_UTF8_MALLOC(location, 1);
Expand Down Expand Up @@ -364,7 +364,7 @@ struct PutWorker : public BaseWorker {
/**
* Puts a key and a value to the database.
*/
NAPI_METHOD(put) {
NAPI_METHOD(db_put) {
NAPI_ARGV(5);
NAPI_DB_CONTEXT();

Expand All @@ -383,7 +383,7 @@ NAPI_METHOD(put) {
}

NAPI_INIT() {
NAPI_EXPORT_FUNCTION(leveldown);
NAPI_EXPORT_FUNCTION(open);
NAPI_EXPORT_FUNCTION(put);
NAPI_EXPORT_FUNCTION(db);
NAPI_EXPORT_FUNCTION(db_open);
NAPI_EXPORT_FUNCTION(db_put);
}

0 comments on commit e37cda0

Please sign in to comment.