From 3bc5596830cc066f216be4e9f5463e61a268f8f0 Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Wed, 17 Aug 2016 15:52:04 +0200 Subject: [PATCH] refactor: Migrate to pull-streams --- .travis.yml | 1 + API.md | 59 ++--- README.md | 6 +- package.json | 17 +- src/index.js | 90 +++---- test/block-service-test.js | 225 ++++++++---------- test/browser.js | 17 +- test/node.js | 15 +- ...OCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data} | 0 ...JNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data} | Bin ...ZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data} | 0 ...74EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data} | Bin ...SCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data} | 0 ...YIDYAQ347ZS7V7IAQNXZZKVVTWQI6UQJBU3Y.data} | Bin ...PKFEHKCVHQ7UCB7UY3P3ICMN7ODTZM2J5G4Y.data} | Bin ...NT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data} | Bin ...DTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data} | 0 ...BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data} | 0 ...R3YOWESA6RDJMOEAJS44MZPLJMQDVOMAZJOQ.data} | Bin ...OQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data} | 0 ...TQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data} | Bin ...VNSCUDXHNOYLDHLFGOBF2AGU34VMTJWK6L4I.data} | Bin ...XLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data} | 0 ...VY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data} | Bin ...P4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data} | 0 ...JNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data} | 0 ...LTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data} | Bin ...JNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data} | 0 ...JNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data} | 0 ...FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data} | Bin ...E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data} | 0 ...5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data} | Bin ...IYLSCSDUHCC6ZP2X4ZZJYBIJH3TC6UMVIQ7Y.data} | Bin ...7JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data} | 0 ...4OKSZR22J4N3S7CKJ3LHMKXIJTY7BPLEFDQY.data} | 0 ...YYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data} | 0 ...H7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data} | Bin ...IM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data} | 0 ...3ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data} | 0 test/test-repo/datastore/CURRENT | 2 +- test/test-repo/datastore/LOG | 15 +- test/test-repo/datastore/LOG.old | 18 +- test/test-repo/datastore/MANIFEST-000007 | Bin 293 -> 0 bytes test/test-repo/datastore/MANIFEST-000009 | Bin 0 -> 192 bytes test/test-repo/version | 2 +- 45 files changed, 195 insertions(+), 272 deletions(-) rename test/test-repo/blocks/{1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data => CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data} (100%) rename test/test-repo/blocks/{122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data => CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data} (100%) rename test/test-repo/blocks/{122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data => CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data} (100%) rename test/test-repo/blocks/{12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data => CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data} (100%) rename test/test-repo/blocks/{12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data => CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data} (100%) rename test/test-repo/blocks/{12205dff/12205dffb3c88f3de7036dc1840f0086f9fccbf5fa0106df39556b3b411ea4121a6f.data => CIQF3/CIQF375TZCHT3ZYDNXAYIDYAQ347ZS7V7IAQNXZZKVVTWQI6UQJBU3Y.data} (100%) rename test/test-repo/blocks/{1220503a/1220503aec3bbd533b39fd56f5148750aa787e820fe98dbf68131bf70e796693d373.data => CIQFA/CIQFAOXMHO6VGOZZ7VLPKFEHKCVHQ7UCB7UY3P3ICMN7ODTZM2J5G4Y.data} (100%) rename test/test-repo/blocks/{12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data => CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data} (100%) rename test/test-repo/blocks/{122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data => CIQFF/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data} (100%) rename test/test-repo/blocks/{12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data => CIQFT/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data} (100%) rename test/test-repo/blocks/{12206006/1220600627d80642365010791de1d62481e88d2c710099738ccbd6964075730194ba.data => CIQGA/CIQGABRH3ADEENSQCB4R3YOWESA6RDJMOEAJS44MZPLJMQDVOMAZJOQ.data} (100%) rename test/test-repo/blocks/{122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data => CIQGF/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data} (100%) rename test/test-repo/blocks/{12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data => CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data} (100%) rename test/test-repo/blocks/{12207d5c/12207d5cd815f41ac0566dd956c8541dced761633aca6704ba01a9be55934d95e5f1.data => CIQH2/CIQH2XGYCX2BVQCWNXMVNSCUDXHNOYLDHLFGOBF2AGU34VMTJWK6L4I.data} (100%) rename test/test-repo/blocks/{12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data => CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data} (100%) rename test/test-repo/blocks/{12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data => CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data} (100%) rename test/test-repo/blocks/{1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data => CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data} (100%) rename test/test-repo/blocks/{12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data => CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data} (100%) rename test/test-repo/blocks/{12209d6c/12209d6c2be50f706953479ab9df2ce3edca90b68053c00b3004b7f0accbe1e8eedf.data => CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data} (100%) rename test/test-repo/blocks/{122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data => CIQJB/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data} (100%) rename test/test-repo/blocks/{1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data => CIQJF/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data} (100%) rename test/test-repo/blocks/{1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data => CIQJG/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data} (100%) rename test/test-repo/blocks/{1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data => CIQKK/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data} (100%) rename test/test-repo/blocks/{1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data => CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data} (100%) rename test/test-repo/blocks/{1220d15b/1220d15b2cf7ecc6eccbf7e68c2e4290e8710bd97eafcce5380a127dcc5ea32a887f.data => CIQNC/CIQNCWZM67WMN3GL67TIYLSCSDUHCC6ZP2X4ZZJYBIJH3TC6UMVIQ7Y.data} (100%) rename test/test-repo/blocks/{1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data => CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data} (100%) rename test/test-repo/blocks/{1220e5f8/1220e5f87b2b69cb032267bbc72a598eb49e3772f8949dacec55d099e3e17ac851c3.data => CIQOL/CIQOL6D3FNU4WAZCM654OKSZR22J4N3S7CKJ3LHMKXIJTY7BPLEFDQY.data} (100%) rename test/test-repo/blocks/{1220e586/1220e586199640e1a4c63fa38c5434b9e72dc99d23a391d3db5e1e42d00527241671.data => CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data} (100%) rename test/test-repo/blocks/{1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data => CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data} (100%) rename test/test-repo/blocks/{1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data => CIQON/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data} (100%) rename test/test-repo/blocks/{1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data => CIQOY/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data} (100%) delete mode 100644 test/test-repo/datastore/MANIFEST-000007 create mode 100644 test/test-repo/datastore/MANIFEST-000009 diff --git a/.travis.yml b/.travis.yml index e1d6320..d86ec62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: node_js node_js: - 4 - 5 + - "stable" # Make sure we have new NPM. before_install: diff --git a/API.md b/API.md index f8de02c..60a7939 100644 --- a/API.md +++ b/API.md @@ -6,10 +6,14 @@ const BlockService = require('ipfs-block-service') ### `new BlockService(repo)` +- `repo: Repo` + Creates a new block service backed by [IPFS Repo][repo] `repo` for storage. ### `goOnline(bitswap)` +- `bitswap: Bitswap` + Add a bitswap instance that communicates with the network to retreive blocks that are not in the local store. @@ -24,53 +28,40 @@ Remove the bitswap instance and fall back to offline mode. Returns a `Boolean` indicating if the block service is online or not. -### `addBlock(block, callback(err))` +### `put(block, callback)` + +- `block: Block` +- `callback: Function` Asynchronously adds a block instance to the underlying repo. -### `addBlocks(blocks, callback(err))` +### `putStream()` -Asynchronously adds an array of block instances to the underlying repo. +Returns a through pull-stream, which `Block`s can be written to, and +that emits the meta data about the written block. -*Does not guarantee atomicity.* +### `get(multihash [, extension], callback)` -### `getBlock(multihash, callback(err, block))` +- `multihash: Multihash` +- `extension: String`, defaults to 'data' +- `callback: Function` Asynchronously returns the block whose content multihash matches `multihash`. -Returns an error (`err.code === 'ENOENT'`) if the block does not exist. - -If the block could not be found, expect `err.code` to be `'ENOENT'`. - -### `getBlocks(multihashes, callback(err, blocks))` - -Asynchronously returns the blocks whose content multihashes match the array -`multihashes`. - -`blocks` is an object that maps each `multihash` to an object of the form - -```js -{ - err: Error - block: Block -} -``` - -Expect `blocks[multihash].err.code === 'ENOENT'` and `blocks[multihash].block -=== null` if a block did not exist. -*Does not guarantee atomicity.* +### `getStream(multihash [, extension])` -### `deleteBlock(multihash, callback(err))` +- `multihash: Multihash` +- `extension: String`, defaults to 'data' -Asynchronously deletes the block from the store with content multihash matching -`multihash`, if it exists. +Returns a source pull-stream, which emits the requested block. -### `bs.deleteBlocks(multihashes, callback(err))` +### `delete(multihashes, [, extension], callback)` -Asynchronously deletes all blocks from the store with content multihashes matching -from the array `multihashes`. +- `multihashes: Multihash|[]Multihash` +- `extension: String`, defaults to 'data'- `extension: String`, defaults to 'data' +- `callback: Function` -*Does not guarantee atomicity.* +Deletes all blocks referenced by multihashes. -[multihash]: https://github.com/jbenet/js-multihash +[multihash]: https://github.com/multiformats/js-multihash [repo]: https://github.com/ipfs/specs/tree/master/repo diff --git a/README.md b/README.md index 8c9b08f..ac2b9f1 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,13 @@ const BlockService = require('ipfs-block-service') const BlockService = require('ipfs-block-service') const Block = require('ipfs-block') const IPFSRepo = require('ipfs-repo') // storage repo -const memstore = require('abstract-blob-store') // in-memory store +const Store = require(interface-pull-blob-store') // in-memory store // setup a repo -var repo = new IPFSRepo('example', { stores: memstore }) +var repo = new IPFSRepo('example', { stores: Store }) // create a block -const block = new Block('hello warld') +const block = new Block('hello world) console.log(block.data) console.log(block.key) diff --git a/package.json b/package.json index d8682b6..842221d 100644 --- a/package.json +++ b/package.json @@ -37,22 +37,21 @@ }, "homepage": "https://github.com/ipfs/js-ipfs-block-service#readme", "devDependencies": { - "aegir": "^3.0.0", - "bs58": "^3.0.0", + "aegir": "^8.0.0", "buffer-loader": "0.0.1", "chai": "^3.5.0", - "fs-blob-store": "^5.2.1", - "idb-plus-blob-store": "^1.1.2", + "fs-pull-blob-store": "^0.3.0", + "idb-pull-blob-store": "^0.4.0", "ipfs-block": "^0.3.0", - "ipfs-repo": "^0.7.1", - "lodash": "^4.8.2", + "ipfs-repo": "^0.9.0", + "lodash": "^4.15.0", "ncp": "^2.0.0", - "pre-commit": "^1.1.2", - "rimraf": "^2.5.1", + "pre-commit": "^1.1.3", + "rimraf": "^2.5.4", "run-series": "^1.1.4" }, "dependencies": { - "multihashes": "^0.2.2", + "pull-stream": "^3.4.5", "run-parallel-limit": "^1.0.3" }, "contributors": [ diff --git a/src/index.js b/src/index.js index 7d18bd1..5ee06b9 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ 'use strict' const parallelLimit = require('run-parallel-limit') -const mh = require('multihashes') +const pull = require('pull-stream') // BlockService is a hybrid block datastore. It stores data in a local // datastore and may retrieve data from a remote Exchange. @@ -24,88 +24,62 @@ module.exports = class BlockService { return this._bitswap != null } - addBlock (block, extension, callback) { - if (this.isOnline()) { - if (typeof extension === 'function') { - callback = extension - extension = undefined - } - - this._bitswap.hasBlock(block, callback) - } else { - this._repo.datastore.put(block, extension, callback) - } - } - - addBlocks (blocks, callback) { - if (!Array.isArray(blocks)) { - return callback(new Error('expects an array of Blocks')) + put (block, callback) { + callback = callback || (() => {}) + if (!block) { + return callback(new Error('Missing block')) } - parallelLimit(blocks.map((block) => (next) => { - this.addBlock(block, next) - }), 100, callback) + pull( + pull.values([block]), + this.putStream(), + pull.onEnd(callback) + ) } - getBlock (key, extension, callback) { + putStream () { if (this.isOnline()) { - if (typeof extension === 'function') { - callback = extension - extension = undefined - } - - this._bitswap.getBlock(key, callback) - } else { - this._repo.datastore.get(key, extension, callback) + return this._bitswap.putStream() } + + return this._repo.blockstore.putStream() } - getBlocks (multihashes, extension, callback) { + get (key, extension, callback) { if (typeof extension === 'function') { callback = extension extension = undefined } - if (!Array.isArray(multihashes)) { - return callback(new Error('Invalid batch of multihashes')) - } + pull( + this.getStream(key, extension), + pull.collect((err, result) => { + if (err) return callback(err) + callback(null, result[0]) + }) + ) + } + getStream (key, extension) { if (this.isOnline()) { - this._bitswap.getBlocks(multihashes, (results) => { - callback(null, results) - }) - return + return this._bitswap.getStream(key) } - const results = {} - parallelLimit(multihashes.map((key) => (next) => { - this._repo.datastore.get(key, extension, (error, block) => { - results[mh.toB58String(key)] = {error, block} - next() - }) - }), 100, (err) => { - callback(err, results) - }) + return this._repo.blockstore.getStream(key, extension) } - deleteBlock (key, extension, callback) { - this._repo.datastore.delete(key, extension, callback) - } - - deleteBlocks (multihashes, extension, callback) { + delete (keys, extension, callback) { if (typeof extension === 'function') { callback = extension extension = undefined } - if (!Array.isArray(multihashes)) { - return callback(new Error('Invalid batch of multihashes')) + if (!Array.isArray(keys)) { + keys = [keys] } - parallelLimit(multihashes.map((multihash) => (next) => { - this.deleteBlock(multihash, extension, next) - }), 100, (err) => { - callback(err) - }) + parallelLimit(keys.map((key) => (next) => { + this._repo.blockstore.delete(key, extension, next) + }), 100, callback) } } diff --git a/test/block-service-test.js b/test/block-service-test.js index c4ecd53..1b3f2f9 100644 --- a/test/block-service-test.js +++ b/test/block-service-test.js @@ -3,7 +3,10 @@ const expect = require('chai').expect const Block = require('ipfs-block') -const mh = require('multihashes') +const pull = require('pull-stream') +const _ = require('lodash') +const series = require('run-series') + const BlockService = require('../src') module.exports = (repo) => { @@ -17,33 +20,33 @@ module.exports = (repo) => { describe('offline', () => { it('store and get a block', (done) => { const b = new Block('A random data block') - bs.addBlock(b, (err) => { - expect(err).to.not.exist - bs.getBlock(b.key, (err, block) => { - expect(err).to.not.exist - expect(b.data.equals(block.data)).to.equal(true) - expect(b.key.equals(block.key)).to.equal(true) - done() + + series([ + (cb) => bs.put(b, cb), + (cb) => bs.get(b.key, (err, block) => { + if (err) return cb(err) + expect(b).to.be.eql(block) + cb() }) - }) + ], done) }) it('store and get a block, with custom extension', (done) => { const b = new Block('A random data block 2', 'ext') - bs.addBlock(b, (err) => { - expect(err).to.not.exist - bs.getBlock(b.key, 'ext', (err, block) => { - expect(err).to.not.exist - expect(b.data.equals(block.data)).to.equal(true) - expect(b.key.equals(block.key)).to.equal(true) - done() + + series([ + (cb) => bs.put(b, cb), + (cb) => bs.get(b.key, 'ext', (err, block) => { + if (err) return cb(err) + expect(b).to.be.eql(block) + cb() }) - }) + ], done) }) it('get a non existent block', (done) => { const b = new Block('Not stored') - bs.getBlock(b.key, (err, block) => { + bs.get(b.key, (err, block) => { expect(err).to.exist done() }) @@ -54,30 +57,19 @@ module.exports = (repo) => { const b2 = new Block('2') const b3 = new Block('3') - bs.addBlocks([b1, b2, b3], (err) => { - expect(err).to.not.exist - done() - }) - }) - - it('addBlocks: bad invocation', (done) => { - const b1 = new Block('1') - - bs.addBlocks(b1, (err) => { - expect(err).to.be.an('error') - done() - }) - }) - - it('getBlock: bad invocation', (done) => { - bs.getBlock(null, (err) => { - expect(err).to.be.an('error') - done() - }) + pull( + pull.values([b1, b2, b3]), + bs.putStream(), + pull.collect((err, meta) => { + expect(err).to.not.exist + expect(meta).to.have.length(3) + done() + }) + ) }) - it('getBlocks: bad invocation', (done) => { - bs.getBlocks(null, 'protobuf', (err) => { + it('get: bad invocation', (done) => { + bs.get(null, (err) => { expect(err).to.be.an('error') done() }) @@ -88,58 +80,37 @@ module.exports = (repo) => { const b2 = new Block('2') const b3 = new Block('3') - bs.addBlocks([b1, b2, b3], (err) => { - expect(err).to.not.exist - - bs.getBlocks([b1.key, b2.key, b3.key], (err, blocks) => { + pull( + pull.values([b1, b2, b3]), + bs.putStream(), + pull.onEnd((err) => { expect(err).to.not.exist - expect(Object.keys(blocks)).to.have.lengthOf(3) - expect(blocks[mh.toB58String(b1.key)]).to.exist - expect(blocks[mh.toB58String(b1.key)].error).to.not.exist - expect(blocks[mh.toB58String(b1.key)].block.data).to.deep.equal(b1.data) - expect(blocks[mh.toB58String(b2.key)]).to.exist - expect(blocks[mh.toB58String(b2.key)].error).to.not.exist - expect(blocks[mh.toB58String(b2.key)].block.data).to.deep.equal(b2.data) - expect(blocks[mh.toB58String(b3.key)]).to.exist - expect(blocks[mh.toB58String(b3.key)].error).to.not.exist - expect(blocks[mh.toB58String(b3.key)].block.data).to.deep.equal(b3.data) - done() + getAndAssert() }) - }) - }) + ) - it('get many blocks: partial success', (done) => { - const b1 = new Block('a1') - const b2 = new Block('a2') - const b3 = new Block('a3') + function getAndAssert () { + pull( + pull.values([b1.key, b2.key, b3.key]), + pull.map((key) => bs.getStream(key)), + pull.flatten(), + pull.collect((err, blocks) => { + expect(err).to.not.exist - bs.addBlocks([b1, b3], (err) => { - expect(err).to.not.exist - - bs.getBlocks([b1.key, b2.key, b3.key], (err, blocks) => { - expect(err).to.not.exist - expect(Object.keys(blocks)).to.have.lengthOf(3) - expect(blocks[mh.toB58String(b1.key)]).to.exist - expect(blocks[mh.toB58String(b1.key)].error).to.not.exist - expect(blocks[mh.toB58String(b1.key)].block.data).to.deep.equal(b1.data) - expect(blocks[mh.toB58String(b2.key)]).to.exist - expect(blocks[mh.toB58String(b2.key)].error).to.exist - expect(blocks[mh.toB58String(b2.key)].block).to.not.exist - expect(blocks[mh.toB58String(b3.key)]).to.exist - expect(blocks[mh.toB58String(b3.key)].error).to.not.exist - expect(blocks[mh.toB58String(b3.key)].block.data).to.deep.equal(b3.data) - done() - }) - }) + expect(blocks).to.be.eql([b1, b2, b3]) + done() + }) + ) + } }) it('delete a block', (done) => { const b = new Block('Will not live that much') - bs.addBlock(b, (err) => { + bs.put(b, (err) => { expect(err).to.not.exist - bs.deleteBlock(b.key, (err) => { + bs.delete(b.key, (err) => { expect(err).to.not.exist - bs.getBlock(b.key, (err, block) => { + bs.get(b.key, (err, block) => { expect(err).to.exist done() }) @@ -147,8 +118,8 @@ module.exports = (repo) => { }) }) - it('deleteBlock: bad invocation', (done) => { - bs.deleteBlock(null, (err) => { + it('delete: bad invocation', (done) => { + bs.delete(null, (err) => { expect(err).to.be.an('error') done() }) @@ -156,11 +127,11 @@ module.exports = (repo) => { it('delete a block, with custom extension', (done) => { const b = new Block('Will not live that much', 'ext') - bs.addBlock(b, (err) => { + bs.put(b, (err) => { expect(err).to.not.exist - bs.deleteBlock(b.key, 'ext', (err) => { + bs.delete(b.key, 'ext', (err) => { expect(err).to.not.exist - bs.getBlock(b.key, 'ext', (err, block) => { + bs.get(b.key, 'ext', (err, block) => { expect(err).to.exist done() }) @@ -170,7 +141,7 @@ module.exports = (repo) => { it('delete a non existent block', (done) => { const b = new Block('I do not exist') - bs.deleteBlock(b.key, (err) => { + bs.delete(b.key, (err) => { expect(err).to.not.exist done() }) @@ -181,38 +152,38 @@ module.exports = (repo) => { const b2 = new Block('2') const b3 = new Block('3') - bs.deleteBlocks([b1, b2, b3], 'data', (err) => { + bs.delete([b1, b2, b3], 'data', (err) => { expect(err).to.not.exist done() }) }) - it('deleteBlocks: bad invocation', (done) => { - bs.deleteBlocks(null, (err) => { - expect(err).to.be.an('error') - done() - }) - }) - it('stores and gets lots of blocks', function (done) { this.timeout(60 * 1000) - const blocks = [] - const count = 1000 - while (blocks.length < count) { - blocks.push(new Block('hello-' + Math.random())) - } - - bs.addBlocks(blocks, (err) => { - expect(err).to.not.exist + const blocks = _.range(1000).map((i) => { + return new Block(`hello-${i}-${Math.random()}`) + }) - bs.getBlocks(blocks.map((b) => b.key), (err, res) => { + pull( + pull.values(blocks), + bs.putStream(), + pull.onEnd((err) => { expect(err).to.not.exist - expect(Object.keys(res)).to.have.length(count) - done() + pull( + pull.values(blocks), + pull.map((b) => b.key), + pull.map((key) => bs.getStream(key)), + pull.flatten(), + pull.collect((err, res) => { + expect(err).to.not.exist + expect(res).to.be.eql(blocks) + done() + }) + ) }) - }) + ) }) it('goes offline', () => { @@ -236,13 +207,13 @@ module.exports = (repo) => { it('retrieves a block through bitswap', (done) => { const bitswap = { - getBlock (key, cb) { - cb(null, new Block(key)) + getStream (key) { + return pull.values([new Block(key)]) } } bs.goOnline(bitswap) - bs.getBlock('secret', (err, res) => { + bs.get('secret', (err, res) => { expect(err).to.not.exist expect(res).to.be.eql(new Block('secret')) done() @@ -251,34 +222,32 @@ module.exports = (repo) => { it('puts the block through bitswap', (done) => { const bitswap = { - hasBlock (block, cb) { - cb() + putStream () { + return pull.through(() => {}) } } bs.goOnline(bitswap) - bs.addBlock(new Block('secret sauce'), done) + bs.put(new Block('secret sauce'), done) }) - it('getBlocks through bitswap', (done) => { - const b1 = new Block('secret sauce 1') - const b2 = new Block('secret sauce 2') + it('getStream through bitswap', (done) => { + const b = new Block('secret sauce 1') const bitswap = { - getBlocks (keys, cb) { - cb({ - [mh.toB58String(b1.key)]: {block: b1}, - [mh.toB58String(b2.key)]: {block: b2} - }) + getStream () { + return pull.values([b]) } } bs.goOnline(bitswap) - bs.getBlocks([b1.key, b2.key], (err, results) => { - expect(err).to.not.exist - expect(results[mh.toB58String(b1.key)].block).to.be.eql(b1) - expect(results[mh.toB58String(b2.key)].block).to.be.eql(b2) - done() - }) + pull( + bs.getStream(b.key), + pull.collect((err, res) => { + expect(err).to.not.exist + expect(res).to.be.eql([b]) + done() + }) + ) }) }) }) diff --git a/test/browser.js b/test/browser.js index 5343878..5e28d91 100644 --- a/test/browser.js +++ b/test/browser.js @@ -2,9 +2,10 @@ 'use strict' const series = require('run-series') -const store = require('idb-plus-blob-store') +const Store = require('idb-pull-blob-store') const _ = require('lodash') const IPFSRepo = require('ipfs-repo') +const pull = require('pull-stream') const repoContext = require.context('buffer!./test-repo', true) const tests = require('./block-service-test') @@ -18,7 +19,6 @@ idb.deleteDatabase('ipfs') idb.deleteDatabase('ipfs/blocks') describe('IPFS Repo Tests on the Browser', function () { - this.timeout(1000) before((done) => { const repoData = [] repoContext.keys().forEach((key) => { @@ -28,8 +28,8 @@ describe('IPFS Repo Tests on the Browser', function () { }) }) - const mainBlob = store('ipfs') - const blocksBlob = store('ipfs/blocks') + const mainBlob = new Store('ipfs') + const blocksBlob = new Store('ipfs/blocks') series(repoData.map((file) => (cb) => { if (_.startsWith(file.key, 'datastore/')) { @@ -41,12 +41,13 @@ describe('IPFS Repo Tests on the Browser', function () { const key = blocks ? file.key.replace(/^blocks\//, '') : file.key - blob.createWriteStream({ - key: key - }).end(file.value, cb) + pull( + pull.values([file.value]), + blob.write(key, cb) + ) }), done) }) - const repo = new IPFSRepo('ipfs', {stores: store}) + const repo = new IPFSRepo('ipfs', {stores: Store}) tests(repo) }) diff --git a/test/node.js b/test/node.js index 3db9e1a..94eaf81 100644 --- a/test/node.js +++ b/test/node.js @@ -3,9 +3,9 @@ const ncp = require('ncp').ncp const rimraf = require('rimraf') -const expect = require('chai').expect const path = require('path') const IPFSRepo = require('ipfs-repo') +const Store = require('fs-pull-blob-store') const tests = require('./block-service-test') @@ -15,20 +15,13 @@ describe('IPFS Block Tests on Node.js', () => { const repoPath = testRepoPath + '-for-' + date before((done) => { - ncp(testRepoPath, repoPath, (err) => { - expect(err).to.not.exist - done() - }) + ncp(testRepoPath, repoPath, done) }) after((done) => { - rimraf(repoPath, (err) => { - expect(err).to.not.exist - done() - }) + rimraf(repoPath, done) }) - const fs = require('fs-blob-store') - const repo = new IPFSRepo(repoPath, {stores: fs}) + const repo = new IPFSRepo(repoPath, {stores: Store}) tests(repo) }) diff --git a/test/test-repo/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data b/test/test-repo/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data similarity index 100% rename from test/test-repo/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data rename to test/test-repo/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data diff --git a/test/test-repo/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data b/test/test-repo/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data similarity index 100% rename from test/test-repo/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data rename to test/test-repo/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data diff --git a/test/test-repo/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data b/test/test-repo/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data similarity index 100% rename from test/test-repo/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data rename to test/test-repo/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data diff --git a/test/test-repo/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data b/test/test-repo/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data similarity index 100% rename from test/test-repo/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data rename to test/test-repo/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data diff --git a/test/test-repo/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data b/test/test-repo/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data similarity index 100% rename from test/test-repo/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data rename to test/test-repo/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data diff --git a/test/test-repo/blocks/12205dff/12205dffb3c88f3de7036dc1840f0086f9fccbf5fa0106df39556b3b411ea4121a6f.data b/test/test-repo/blocks/CIQF3/CIQF375TZCHT3ZYDNXAYIDYAQ347ZS7V7IAQNXZZKVVTWQI6UQJBU3Y.data similarity index 100% rename from test/test-repo/blocks/12205dff/12205dffb3c88f3de7036dc1840f0086f9fccbf5fa0106df39556b3b411ea4121a6f.data rename to test/test-repo/blocks/CIQF3/CIQF375TZCHT3ZYDNXAYIDYAQ347ZS7V7IAQNXZZKVVTWQI6UQJBU3Y.data diff --git a/test/test-repo/blocks/1220503a/1220503aec3bbd533b39fd56f5148750aa787e820fe98dbf68131bf70e796693d373.data b/test/test-repo/blocks/CIQFA/CIQFAOXMHO6VGOZZ7VLPKFEHKCVHQ7UCB7UY3P3ICMN7ODTZM2J5G4Y.data similarity index 100% rename from test/test-repo/blocks/1220503a/1220503aec3bbd533b39fd56f5148750aa787e820fe98dbf68131bf70e796693d373.data rename to test/test-repo/blocks/CIQFA/CIQFAOXMHO6VGOZZ7VLPKFEHKCVHQ7UCB7UY3P3ICMN7ODTZM2J5G4Y.data diff --git a/test/test-repo/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data b/test/test-repo/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data similarity index 100% rename from test/test-repo/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data rename to test/test-repo/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data diff --git a/test/test-repo/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data b/test/test-repo/blocks/CIQFF/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data similarity index 100% rename from test/test-repo/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data rename to test/test-repo/blocks/CIQFF/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data diff --git a/test/test-repo/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data b/test/test-repo/blocks/CIQFT/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data similarity index 100% rename from test/test-repo/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data rename to test/test-repo/blocks/CIQFT/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data diff --git a/test/test-repo/blocks/12206006/1220600627d80642365010791de1d62481e88d2c710099738ccbd6964075730194ba.data b/test/test-repo/blocks/CIQGA/CIQGABRH3ADEENSQCB4R3YOWESA6RDJMOEAJS44MZPLJMQDVOMAZJOQ.data similarity index 100% rename from test/test-repo/blocks/12206006/1220600627d80642365010791de1d62481e88d2c710099738ccbd6964075730194ba.data rename to test/test-repo/blocks/CIQGA/CIQGABRH3ADEENSQCB4R3YOWESA6RDJMOEAJS44MZPLJMQDVOMAZJOQ.data diff --git a/test/test-repo/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data b/test/test-repo/blocks/CIQGF/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data similarity index 100% rename from test/test-repo/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data rename to test/test-repo/blocks/CIQGF/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data diff --git a/test/test-repo/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data b/test/test-repo/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data similarity index 100% rename from test/test-repo/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data rename to test/test-repo/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data diff --git a/test/test-repo/blocks/12207d5c/12207d5cd815f41ac0566dd956c8541dced761633aca6704ba01a9be55934d95e5f1.data b/test/test-repo/blocks/CIQH2/CIQH2XGYCX2BVQCWNXMVNSCUDXHNOYLDHLFGOBF2AGU34VMTJWK6L4I.data similarity index 100% rename from test/test-repo/blocks/12207d5c/12207d5cd815f41ac0566dd956c8541dced761633aca6704ba01a9be55934d95e5f1.data rename to test/test-repo/blocks/CIQH2/CIQH2XGYCX2BVQCWNXMVNSCUDXHNOYLDHLFGOBF2AGU34VMTJWK6L4I.data diff --git a/test/test-repo/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data b/test/test-repo/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data similarity index 100% rename from test/test-repo/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data rename to test/test-repo/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data diff --git a/test/test-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data b/test/test-repo/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data similarity index 100% rename from test/test-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data rename to test/test-repo/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data diff --git a/test/test-repo/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data b/test/test-repo/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data similarity index 100% rename from test/test-repo/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data rename to test/test-repo/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data diff --git a/test/test-repo/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data b/test/test-repo/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data similarity index 100% rename from test/test-repo/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data rename to test/test-repo/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data diff --git a/test/test-repo/blocks/12209d6c/12209d6c2be50f706953479ab9df2ce3edca90b68053c00b3004b7f0accbe1e8eedf.data b/test/test-repo/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data similarity index 100% rename from test/test-repo/blocks/12209d6c/12209d6c2be50f706953479ab9df2ce3edca90b68053c00b3004b7f0accbe1e8eedf.data rename to test/test-repo/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data diff --git a/test/test-repo/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data b/test/test-repo/blocks/CIQJB/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data similarity index 100% rename from test/test-repo/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data rename to test/test-repo/blocks/CIQJB/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data diff --git a/test/test-repo/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data b/test/test-repo/blocks/CIQJF/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data similarity index 100% rename from test/test-repo/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data rename to test/test-repo/blocks/CIQJF/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data diff --git a/test/test-repo/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data b/test/test-repo/blocks/CIQJG/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data similarity index 100% rename from test/test-repo/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data rename to test/test-repo/blocks/CIQJG/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data diff --git a/test/test-repo/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data b/test/test-repo/blocks/CIQKK/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data similarity index 100% rename from test/test-repo/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data rename to test/test-repo/blocks/CIQKK/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data diff --git a/test/test-repo/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data b/test/test-repo/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data similarity index 100% rename from test/test-repo/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data rename to test/test-repo/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data diff --git a/test/test-repo/blocks/1220d15b/1220d15b2cf7ecc6eccbf7e68c2e4290e8710bd97eafcce5380a127dcc5ea32a887f.data b/test/test-repo/blocks/CIQNC/CIQNCWZM67WMN3GL67TIYLSCSDUHCC6ZP2X4ZZJYBIJH3TC6UMVIQ7Y.data similarity index 100% rename from test/test-repo/blocks/1220d15b/1220d15b2cf7ecc6eccbf7e68c2e4290e8710bd97eafcce5380a127dcc5ea32a887f.data rename to test/test-repo/blocks/CIQNC/CIQNCWZM67WMN3GL67TIYLSCSDUHCC6ZP2X4ZZJYBIJH3TC6UMVIQ7Y.data diff --git a/test/test-repo/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data b/test/test-repo/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data similarity index 100% rename from test/test-repo/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data rename to test/test-repo/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data diff --git a/test/test-repo/blocks/1220e5f8/1220e5f87b2b69cb032267bbc72a598eb49e3772f8949dacec55d099e3e17ac851c3.data b/test/test-repo/blocks/CIQOL/CIQOL6D3FNU4WAZCM654OKSZR22J4N3S7CKJ3LHMKXIJTY7BPLEFDQY.data similarity index 100% rename from test/test-repo/blocks/1220e5f8/1220e5f87b2b69cb032267bbc72a598eb49e3772f8949dacec55d099e3e17ac851c3.data rename to test/test-repo/blocks/CIQOL/CIQOL6D3FNU4WAZCM654OKSZR22J4N3S7CKJ3LHMKXIJTY7BPLEFDQY.data diff --git a/test/test-repo/blocks/1220e586/1220e586199640e1a4c63fa38c5434b9e72dc99d23a391d3db5e1e42d00527241671.data b/test/test-repo/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data similarity index 100% rename from test/test-repo/blocks/1220e586/1220e586199640e1a4c63fa38c5434b9e72dc99d23a391d3db5e1e42d00527241671.data rename to test/test-repo/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data diff --git a/test/test-repo/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data b/test/test-repo/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data similarity index 100% rename from test/test-repo/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data rename to test/test-repo/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data diff --git a/test/test-repo/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data b/test/test-repo/blocks/CIQON/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data similarity index 100% rename from test/test-repo/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data rename to test/test-repo/blocks/CIQON/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data diff --git a/test/test-repo/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data b/test/test-repo/blocks/CIQOY/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data similarity index 100% rename from test/test-repo/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data rename to test/test-repo/blocks/CIQOY/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data diff --git a/test/test-repo/datastore/CURRENT b/test/test-repo/datastore/CURRENT index 875cf23..6ba31a3 100644 --- a/test/test-repo/datastore/CURRENT +++ b/test/test-repo/datastore/CURRENT @@ -1 +1 @@ -MANIFEST-000007 +MANIFEST-000009 diff --git a/test/test-repo/datastore/LOG b/test/test-repo/datastore/LOG index 863b68f..91ceca1 100644 --- a/test/test-repo/datastore/LOG +++ b/test/test-repo/datastore/LOG @@ -1,10 +1,5 @@ -=============== Dec 10, 2015 (PST) =============== -07:50:02.056578 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -07:50:02.057231 db@open opening -07:50:02.057312 journal@recovery F·1 -07:50:02.057514 journal@recovery recovering @3 -07:50:02.058921 mem@flush created L0@5 N·4 S·1KiB "/ip..\xf6\xe4\xa9,v5":"/pk..\xf6\xe4\xa9,v6" -07:50:02.059983 db@janitor F·4 G·0 -07:50:02.060001 db@open done T·2.755926ms -07:50:02.073183 db@close closing -07:50:02.073285 db@close done T·97.522µs +=============== Aug 17, 2016 (CEST) =============== +14:56:56.952145 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +14:56:56.953628 db@open opening +14:56:56.960311 db@janitor F·4 G·0 +14:56:56.960378 db@open done T·6.714095ms diff --git a/test/test-repo/datastore/LOG.old b/test/test-repo/datastore/LOG.old index 708351e..863b68f 100644 --- a/test/test-repo/datastore/LOG.old +++ b/test/test-repo/datastore/LOG.old @@ -1,10 +1,10 @@ =============== Dec 10, 2015 (PST) =============== -07:49:57.048841 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -07:49:57.049014 db@open opening -07:49:57.049066 journal@recovery F·1 -07:49:57.049233 journal@recovery recovering @1 -07:49:57.049693 mem@flush created L0@2 N·2 S·211B "/lo..oot,v2":"/lo..ins,v1" -07:49:57.050381 db@janitor F·3 G·0 -07:49:57.050397 db@open done T·1.375431ms -07:49:57.064580 db@close closing -07:49:57.064655 db@close done T·72.59µs +07:50:02.056578 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +07:50:02.057231 db@open opening +07:50:02.057312 journal@recovery F·1 +07:50:02.057514 journal@recovery recovering @3 +07:50:02.058921 mem@flush created L0@5 N·4 S·1KiB "/ip..\xf6\xe4\xa9,v5":"/pk..\xf6\xe4\xa9,v6" +07:50:02.059983 db@janitor F·4 G·0 +07:50:02.060001 db@open done T·2.755926ms +07:50:02.073183 db@close closing +07:50:02.073285 db@close done T·97.522µs diff --git a/test/test-repo/datastore/MANIFEST-000007 b/test/test-repo/datastore/MANIFEST-000007 deleted file mode 100644 index 6af3b5450fb46c2d16258f242969f0d88dfa5892..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 293 zcmbOjutG$Rk&#gwn zg1lmVAq7dp?z}jjpH|8u`x(_{=^V1TeCJBgb*HmC&F8kceS5N!k(B`q^z;j|iBZl5 rQO?f5beT~?KPNvqF-JcwGbgpUC_lf1kqIIz43#Lz%qwPOgoptEK%P8q literal 0 HcmV?d00001 diff --git a/test/test-repo/version b/test/test-repo/version index 00750ed..b8626c4 100644 --- a/test/test-repo/version +++ b/test/test-repo/version @@ -1 +1 @@ -3 +4