Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using accountdown with level-party causes hangup #12

Closed
ghost opened this issue Sep 5, 2015 · 2 comments
Closed

Using accountdown with level-party causes hangup #12

ghost opened this issue Sep 5, 2015 · 2 comments
Labels
help wanted Extra attention is needed stale This issue or pull request is old

Comments

@ghost
Copy link

ghost commented Sep 5, 2015

Not sure if this is a problem with accountdown or level-party. Running the following code:

 var party = require('level-party');
 var util = require('util');
 var accountdown = require('accountdown');
 var users = accountdown(party('./users'), {
   login: { basic: require('accountdown-basic') }
 });

var opts = {
  login: { basic: {username: "username", password: "password" } },
  value: { }
};

users.create("username", opts, function(err) {
  console.log('test');
});

Prints nothing. The callback to user.create never executes. This works fine with a plain levelup instance. I am inclined to think this is a bug with level-party if it is intended to be a drop in replacement for levelup.

cc @substack @mafintosh

@ghost
Copy link
Author

ghost commented Sep 5, 2015

A more minimal example after removing accountdown from the picture:

var batch = require('level-create-batch');
var defaults = require('levelup-defaults');
var bytewise = require('bytewise');
var party = require('level-party');

var db = defaults(party('./users'), {
  keyEncoding: bytewise,
  valueEncoding: 'json'
});

var rows = [ { key: [ 'account', 'username' ], value: {} },
  { key: [ 'login', 'basic', 'username' ],
    value: 
     { id: 'username',
       hash: '38f182bb364555bc48c81272491e74c055280aaf',
       salt: '772500f88203d25ded7bec0ffb94ed09' } },
  { key: [ 'login-id', 'username', 'basic' ], value: 0 },
  { key: [ 'login-data', 'username', 'basic', 'login', 'basic', 'username' ],
    value: 0 } ];

batch(db, rows, function (err) { 
  console.log('test');
});

So somethings up with either level-create-batch or levelup-defaults

@ghost
Copy link
Author

ghost commented Sep 5, 2015

The above code works if the call to defaults is removed and just uses the party constructor. Would @mafintosh be open to having levelup-defaults support multilevels and level-party?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed stale This issue or pull request is old
Projects
None yet
Development

No branches or pull requests

1 participant