tape('subleveldown on deferred multileveldown client', function (t) { t.plan(5) var db = factory() var stream = multileveldown.server(db) var client = multileveldown.client() var sub1 = sub(client, 'test', { valueEncoding: 'json' }) var sub2 = sub(client, 'test') t.is(client.isOpen(), false) stream.pipe(client.createRpcStream()).pipe(stream) sub1.put('hello', { test: 'world' }, function (err) { t.error(err, 'no err') sub1.createReadStream().pipe(concat(function (entries) { t.same(entries, [{ key: 'hello', value: { test: 'world' } }]) })) sub2.createReadStream().pipe(concat(function (entries) { t.same(entries, [{ key: 'hello', value: '{"test":"world"}' }]) })) db.createReadStream().pipe(concat(function (entries) { t.same(entries, [{ key: '!test!hello', value: '{"test":"world"}' }]) })) }) })
t.error(err, 'no err') sub1.createReadStream().pipe(concat(function (entries) { t.same(entries, [{ key: 'hello', value: { test: 'world' } }]) })) sub2.createReadStream().pipe(concat(function (entries) { t.same(entries, [{ key: 'hello', value: '{"test":"world"}' }]) })) db.createReadStream().pipe(concat(function (entries) { t.same(entries, [{ key: '!test!hello', value: '{"test":"world"}' }]) }))
t.error(err) var tagIndexStream = posts.byTag.createReadStream({ gt: 'foo!', lt: 'foo!~' }) var concatStream = concat(handleResults) tagIndexStream.on('error', handleError) var tagIndexStream = index.tags.createReadStream() var concatStream = concat(handleResults) tagIndexStream.on('error', handleError) var tagIndexStream = posts.byTag.createReadStream({ gt: 'foo!', lt: 'foo!~' }) var concatStream = concat(handleResults) tagIndexStream.on('error', handleError)