diff --git a/.travis.yml b/.travis.yml index e1d6320b..dd9e44ef 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/README.md b/README.md index 4156cbab..99357518 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ This is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs - [repo.config.get(cb(err, config))](#repoconfiggetcberr-config) - [repo.config.set(config, cb(err))](#repoconfigsetconfig-cberr) - [repo.keys](#repokeys) - - [repo.datastore.read(key, cb(err, buffer))](#repodatastorereadkey-cberr-buffer) - - [repo.datastore.write(buffer, cb(err, buffer))](#repodatastorewritebuffer-cberr-buffer) - - [repo.datastoreLegacy](#repodatastorelegacy) + - [repo.blockstore.putStream()](#) + - [repo.blockstore.getStream(key, extension)](#) + - [repo.datastore](#repodatastore) - [Contribute](#contribute) - [License](#license) @@ -45,7 +45,7 @@ Here is the architectural reasoning for this repo: │ interface defined by Repo Spec │ ├─────────────────────────────────┤ │ │ ┌──────────────────────┐ -│ │ │ abstract-blob-store │ +│ │ │ interface-pull-blob-store │ │ IPFS REPO │─────────────────────────────────▶│ interface │ │ │ ├──────────────────────┤ │ │ │ locks │ @@ -60,15 +60,15 @@ Here is the architectural reasoning for this repo: │ interface │ │ interface │ │ interface │ │ interface │ │ interface │ │ interface │ ├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤ │ │ │ │ │ │ │ │ │ │ │ │ -│ keys │ │ config │ │ datastore │ │ datastore │ │ logs │ │ version │ -│ │ │ │ │ │ │ -legacy │ │ │ │ │ +│ keys │ │ config │ │ blockstore │ │ datastore │ │ logs │ │ version │ +│ │ │ │ │ │ │ │ │ │ │ │ └───────────┘ └───────────┘ └───────────┘ └───────────┘ └───────────┘ └───────────┘ ``` This provides a well defined interface for creating and interacting with an IPFS Repo backed by a group of abstract backends for keys, configuration, logs, and more. Each of the individual repos has an interface defined by -[abstract-blob-store](https://github.com/maxogden/abstract-blob-store): this +[interface-pull-blob-store](https://github.com/ipfs/interface-pull-blob-store): this enables us to make IPFS Repo portable (running on Node.js vs the browser) and accept different types of storage mechanisms for each repo (fs, levelDB, etc). @@ -136,7 +136,7 @@ Creates a **reference** to an IPFS repository at the path `path`. This does Valid keys for `opts` include: - `stores`: either an - [abstract-blob-store](https://github.com/maxogden/abstract-blob-store), or a + [interface-pull-blob-store](https://github.com/ipfs/interface-pull-blob-store), or a map of the form ```js @@ -173,12 +173,14 @@ Read/write keys inside the repo. This feature will be expanded once [IPRS](https://github.com/ipfs/specs/tree/master/records) and [KeyChain](https://github.com/ipfs/specs/tree/master/keychain) are finalized and implemented on go-ipfs. -### repo.datastore.read(key, cb(err, buffer)) -### repo.datastore.write(buffer, cb(err, buffer)) +### repo.blockstore.putStream() +### repo.datastore.getStream(key, extension) +### repo.datastore.has(key, extension, cb) +### repo.datastore.delete(key, extension, cb) Read and write buffers to/from the repo's block store. -### repo.datastoreLegacy +### repo.datastore **WIP** diff --git a/package.json b/package.json index fd4a5895..086458c6 100644 --- a/package.json +++ b/package.json @@ -29,27 +29,30 @@ ], "homepage": "https://github.com/ipfs/js-ipfs-repo", "devDependencies": { - "abstract-blob-store": "^3.2.0", - "aegir": "^5.0.1", - "async": "^2.0.1", + "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", - "lodash": "^4.13.1", + "fs-pull-blob-store": "^0.3.0", + "idb-pull-blob-store": "^0.4.0", + "interface-pull-blob-store": "^0.5.0", + "lodash": "^4.15.0", + "multihashes": "^0.2.2", "ncp": "^2.0.0", - "pre-commit": "^1.1.2", - "rimraf": "^2.5.2" + "pre-commit": "^1.1.3", + "rimraf": "^2.5.4" }, "dependencies": { - "babel-runtime": "^6.6.1", - "bl": "^1.1.2", - "concat-stream": "^1.5.1", + "babel-runtime": "^6.11.6", + "base32.js": "^0.1.0", "ipfs-block": "^0.3.0", - "lock": "^0.1.2", - "lockfile": "^1.0.1", - "multihashes": "^0.2.1", - "xtend": "^4.0.1" + "lock": "^0.1.3", + "multihashes": "^0.2.2", + "pull-stream": "^3.4.5", + "pull-through": "^1.0.18", + "pull-write": "^1.1.0", + "run-parallel": "^1.1.6", + "run-series": "^1.1.4", + "safe-buffer": "^5.0.1" }, "license": "MIT", "contributors": [ @@ -61,4 +64,4 @@ "Stephen Whitmore ", "greenkeeperio-bot " ] -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js index b93a7e11..3a110cdd 100644 --- a/src/index.js +++ b/src/index.js @@ -1,53 +1,56 @@ 'use strict' +const assert = require('assert') + const stores = require('./stores') -function Repo (repoPath, options) { - if (!(this instanceof Repo)) { - return new Repo(repoPath, options) +module.exports = class Repo { + constructor (repoPath, options) { + assert.equal(typeof repoPath, 'string', 'missing repoPath') + assert(options, 'missing options') + assert(options.stores, 'missing options.stores') + + this.path = repoPath + + const blobStores = initializeBlobStores(options.stores) + + const setup = (name, needs) => { + needs = needs || {} + const args = [repoPath, blobStores[name]] + if (needs.locks) { + args.push(this.locks) + } + + if (needs.config) { + args.push(this.config) + } + + return stores[name].setUp.apply(stores[name], args) + } + + this.locks = setup('locks') + this.version = setup('version', {locks: true}) + this.config = setup('config', {locks: true}) + this.keys = setup('keys', {locks: true, config: true}) + this.blockstore = setup('blockstore', {locks: true}) + } + + exists (callback) { + this.version.exists(callback) } - if (!options) { throw new Error('missing options param') } - if (!options.stores) { throw new Error('missing options.stores param') } - - // If options.stores is an abstract-blob-store instead of a map, use it for - // all stores. - if (options.stores.prototype && options.stores.prototype.createWriteStream) { - const store = options.stores - options.stores = { +} + +function initializeBlobStores (store) { + if (store.constructor) { + return { keys: store, config: store, - datastore: store, + blockstore: store, logs: store, locks: store, version: store } } - this.path = repoPath - - this.locks = stores - .locks - .setUp(repoPath, options.stores.locks) - - this.exists = (callback) => { - this.version.exists(callback) - } - - this.version = stores - .version - .setUp(repoPath, options.stores.version, this.locks) - - this.config = stores - .config - .setUp(repoPath, options.stores.config, this.locks) - - this.keys = stores - .keys - .setUp(repoPath, options.stores.keys, this.locks, this.config) - - this.datastore = stores - .datastore - .setUp(repoPath, options.stores.datastore, this.locks) + return store } - -exports = module.exports = Repo diff --git a/src/stores/blockstore.js b/src/stores/blockstore.js new file mode 100644 index 00000000..1b13af36 --- /dev/null +++ b/src/stores/blockstore.js @@ -0,0 +1,137 @@ +'use strict' + +const Block = require('ipfs-block') +const pull = require('pull-stream') +const Lock = require('lock') +const base32 = require('base32.js') +const path = require('path') +const write = require('pull-write') +const parallel = require('run-parallel') +const through = require('pull-through') + +const PREFIX_LENGTH = 5 + +exports = module.exports + +function multihashToPath (multihash, extension) { + extension = extension || 'data' + const encoder = new base32.Encoder() + const hash = encoder.write(multihash).finalize() + const filename = `${hash}.${extension}` + const folder = filename.slice(0, PREFIX_LENGTH) + + return path.join(folder, filename) +} + +exports.setUp = (basePath, BlobStore, locks) => { + const store = new BlobStore(basePath + '/blocks') + const lock = new Lock() + + function writeBlock (block, cb) { + if (!block || !block.data) { + return cb(new Error('Invalid block')) + } + + const key = multihashToPath(block.key, block.extension) + + lock(key, (release) => pull( + pull.values([block.data]), + store.write(key, release((err) => { + if (err) { + return cb(err) + } + cb(null, {key}) + })) + )) + } + + return { + getStream (key, extension) { + if (!key) { + return pull.error(new Error('Invalid key')) + } + + const p = multihashToPath(key, extension) + + const ext = extension === 'data' ? 'protobuf' : extension + let data = [] + + return pull( + store.read(p), + through(function (values) { + data = data.concat(values) + }, function () { + this.queue(new Block(Buffer.concat(data), ext)) + this.queue(null) + }) + ) + }, + + putStream () { + let ended = false + let written = [] + let push = null + + const sink = write((blocks, cb) => { + parallel(blocks.map((block) => (cb) => { + writeBlock(block, (err, meta) => { + if (err) return cb(err) + if (push) { + const read = push + push = null + read(null, meta) + return cb() + } + + written.push(meta) + cb() + }) + }), cb) + }, null, 100, (err) => { + ended = err || true + if (push) push(ended) + }) + + const source = (end, cb) => { + if (end) ended = end + if (ended) return cb(ended) + + if (written.length) { + return cb(null, written.shift()) + } + + push = cb + } + + return {source, sink} + }, + + has (key, extension, cb) { + if (typeof extension === 'function') { + cb = extension + extension = undefined + } + + if (!key) { + return cb(new Error('Invalid key')) + } + + const p = multihashToPath(key, extension) + store.exists(p, cb) + }, + + delete (key, extension, cb) { + if (typeof extension === 'function') { + cb = extension + extension = undefined + } + + if (!key) { + return cb(new Error('Invalid key')) + } + + const p = multihashToPath(key, extension) + store.remove(p, cb) + } + } +} diff --git a/src/stores/config.js b/src/stores/config.js index 9ab74943..2a2b8898 100644 --- a/src/stores/config.js +++ b/src/stores/config.js @@ -1,40 +1,51 @@ 'use strict' -const bl = require('bl') +const pull = require('pull-stream') +const series = require('run-series') exports = module.exports -exports.setUp = (basePath, blobStore, locks) => { - const store = blobStore(basePath) +exports.setUp = (basePath, BlobStore, locks) => { + const store = new BlobStore(basePath) + const configFile = 'config' + return { - get: (callback) => { - store - .createReadStream('config') - .pipe(bl((err, config) => { + get (callback) { + pull( + store.read(configFile), + pull.collect((err, values) => { if (err) { return callback(err) } + + const config = Buffer.concat(values) let result try { result = JSON.parse(config.toString()) } catch (err) { return callback(err) } + callback(null, result) - })) + }) + ) }, - set: (config, callback) => { - locks.lock((err) => { - if (err) { - return callback(err) + set (config, callback) { + series([ + (cb) => locks.lock(cb), + (cb) => { + pull( + pull.values([ + new Buffer(JSON.stringify(config, null, 2)) + ]), + store.write(configFile, cb) + ) } - - store.createWriteStream('config') - .once('finish', () => { - locks.unlock(callback) - }) - .end(JSON.stringify(config, null, 2)) + ], (err) => { + locks.unlock((err2) => { + callback(err || err2) + }) }) } } diff --git a/src/stores/datastore-legacy.js b/src/stores/datastore-legacy.js deleted file mode 100644 index 003383a2..00000000 --- a/src/stores/datastore-legacy.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict' - -// TODO: This may end up being configurable -// TODO: This should belong to the `fs` implementation - -const PREFIX_LENGTH = 8 -const multihash = require('multihashes') -const path = require('path') - -module.exports = (store) => { - function hashToPath (hash) { - const folder = hash.slice(0, PREFIX_LENGTH) - return path.join(folder, hash) + '.data' - } - - return { - read: (hash, cb) => { - return store.read(hashToPath(hash), cb) - }, - - write: (buf, cb) => { - const mh = multihash.encode(buf, 'hex') - return store.write(hashToPath(mh), buf, cb) - } - } -} diff --git a/src/stores/datastore.js b/src/stores/datastore.js deleted file mode 100644 index ce6e8127..00000000 --- a/src/stores/datastore.js +++ /dev/null @@ -1,103 +0,0 @@ -'use strict' - -const Lock = require('lock') -const stream = require('stream') -const bl = require('bl') -const Block = require('ipfs-block') - -const PREFIX_LENGTH = 8 - -exports = module.exports - -function multihashToPath (multihash, extension) { - extension = extension || 'data' - const filename = `${multihash.toString('hex')}.${extension}` - const folder = filename.slice(0, PREFIX_LENGTH) - const path = folder + '/' + filename - - return path -} - -exports.setUp = (basePath, blobStore, locks) => { - const store = blobStore(basePath + '/blocks') - const lock = new Lock() - - const createReadStream = (multihash, extension) => { - const path = multihashToPath(multihash, extension) - return store.createReadStream(path) - } - - const createWriteStream = (multihash, extension, cb) => { - const path = multihashToPath(multihash, extension) - const through = stream.PassThrough() - - lock(path, (release) => { - const ws = store.createWriteStream(path, release(cb)) - through.pipe(ws) - }) - - return through - } - - return { - get: (key, extension, cb) => { - if (typeof extension === 'function') { - cb = extension - extension = 'data' - } - - if (!key) { - return cb(new Error('Invalid key')) - } - - createReadStream(key, extension) - .pipe(bl((err, data) => { - if (err) { - return cb(err) - } - if (extension === 'data') { - extension = 'protobuf' - } - cb(null, new Block(data, extension)) - })) - }, - - put: (block, cb) => { - if (!block || !block.data) { - return cb(new Error('Invalid block')) - } - - const ws = createWriteStream(block.key, block.extension, cb) - ws.write(block.data) - ws.end() - }, - - has: (key, extension, cb) => { - if (typeof extension === 'function') { - cb = extension - extension = undefined - } - - if (!key) { - return cb(new Error('Invalid key')) - } - - const path = multihashToPath(key, extension) - store.exists(path, cb) - }, - - delete: (key, extension, cb) => { - if (typeof extension === 'function') { - cb = extension - extension = undefined - } - - if (!key) { - return cb(new Error('Invalid key')) - } - - const path = multihashToPath(key, extension) - store.remove(path, cb) - } - } -} diff --git a/src/stores/index.js b/src/stores/index.js index b7d9eecb..01476e33 100644 --- a/src/stores/index.js +++ b/src/stores/index.js @@ -6,6 +6,4 @@ exports.locks = require('./locks') exports.version = require('./version') exports.config = require('./config') exports.keys = require('./keys') -exports.datastore = require('./datastore') -// exports.datastoreLegacy = require('./datastore-legacy') -// exports.logs = require('./logs') +exports.blockstore = require('./blockstore') diff --git a/src/stores/keys.js b/src/stores/keys.js index 7bf76f86..60831436 100644 --- a/src/stores/keys.js +++ b/src/stores/keys.js @@ -2,9 +2,9 @@ exports = module.exports -exports.setUp = (basePath, blobStore, locks, config) => { +exports.setUp = (basePath, BlobStore, locks, config) => { return { - get: (callback) => { + get (callback) { config.get((err, config) => { if (err) { return callback(err) diff --git a/src/stores/locks.js b/src/stores/locks.js index 42dcdcb9..03f6c345 100644 --- a/src/stores/locks.js +++ b/src/stores/locks.js @@ -1,26 +1,26 @@ 'use strict' +const pull = require('pull-stream') +const series = require('run-series') + exports = module.exports -exports.setUp = (basePath, blobStore) => { - const store = blobStore(basePath) +exports.setUp = (basePath, BlobStore) => { + const store = new BlobStore(basePath) const lockFile = 'repo.lock' return { - lock: function (cb) { + lock (callback) { function createLock () { - store - .createWriteStream(lockFile) - .once('finish', () => { - cb() - }) - .end() + pull( + pull.values([new Buffer('LOCK')]), + store.write(lockFile, callback) + ) } function doesExist (err, exists) { - if (err) { - return cb(err) - } + if (err) return callback(err) + if (exists) { // default 100ms setTimeout(function () { @@ -28,23 +28,26 @@ exports.setUp = (basePath, blobStore) => { }, 100) return } + createLock() } store.exists(lockFile, doesExist) }, - unlock: (cb) => { - store.remove(lockFile, (err) => { - if (err) { return cb(err) } - store.exists(lockFile, (err, exists) => { - if (err) { return cb(err) } - - store.exists(lockFile, (err, exists) => { - if (err) { return cb(err) } - cb() - }) + + unlock (callback) { + series([ + (cb) => store.remove(lockFile, cb), + (cb) => store.exists(lockFile, (err, exists) => { + if (err) return cb(err) + + if (exists) { + return cb(new Error('failed to remove lock')) + } + + cb() }) - }) + ], callback) } } } diff --git a/src/stores/version.js b/src/stores/version.js index 66744d4d..ff65d51b 100644 --- a/src/stores/version.js +++ b/src/stores/version.js @@ -1,37 +1,48 @@ 'use strict' -const bl = require('bl') +const pull = require('pull-stream') +const series = require('run-series') +const toBuffer = require('safe-buffer').Buffer.from exports = module.exports -exports.setUp = (basePath, blobStore, locks) => { - const store = blobStore(basePath) +exports.setUp = (basePath, BlobStore, locks) => { + const store = new BlobStore(basePath) + const versionFile = 'version' return { - exists: (callback) => { - store.exists('version', callback) + exists (callback) { + store.exists(versionFile, callback) }, - get: (callback) => { - store - .createReadStream('version') - .pipe(bl((err, version) => { + get (callback) { + pull( + store.read(versionFile), + pull.collect((err, values) => { if (err) { return callback(err) } - callback(null, version.toString('utf8')) - })) + + const version = Buffer.concat(values).toString('utf8') + callback(null, version) + }) + ) }, - set: (value, callback) => { - locks.lock((err) => { - if (err) { - return callback(err) + set (value, callback) { + series([ + (cb) => locks.lock(cb), + (cb) => { + const values = [ + Buffer.isBuffer(value) ? value : toBuffer(value) + ] + pull( + pull.values(values), + store.write(versionFile, cb) + ) } - - store.createWriteStream('version') - .once('finish', () => { - locks.unlock(callback) - }) - .end(value) + ], (err) => { + locks.unlock((err2) => { + callback(err || err2) + }) }) } } diff --git a/test/blockstore-test.js b/test/blockstore-test.js new file mode 100644 index 00000000..eb801369 --- /dev/null +++ b/test/blockstore-test.js @@ -0,0 +1,231 @@ +/* eslint-env mocha */ +'use strict' + +const expect = require('chai').expect +const Block = require('ipfs-block') +const mh = require('multihashes') +const pull = require('pull-stream') +const parallel = require('run-parallel') +const _ = require('lodash') + +module.exports = (repo) => { + describe('blockstore', () => { + const helloKey = 'CIQLS/CIQLSTJHXGJU2PQIUUXFFV62PWV7VREE57RXUU4A52IIR55M4LX432I.data' + const helloIpldKey = 'CIQO2/CIQO2EUTF47PSTAHSL54KUTDS2AAN2DH4URM7H5KRATUGQFCM4OUIQI.ipld' + const blockCollection = _.range(100).map((i) => new Block(new Buffer(`hello-${i}-${Math.random()}`))) + + describe('.putStream', () => { + it('simple', (done) => { + const b = new Block('hello world') + pull( + pull.values([b]), + repo.blockstore.putStream(), + pull.collect((err, meta) => { + expect(err).to.not.exist + expect(meta[0].key).to.be.eql(helloKey) + done() + }) + ) + }) + + it('multi write (locks)', (done) => { + const b = new Block('hello world') + + let i = 0 + const finish = (err, meta) => { + expect(err).to.not.exist + expect(meta[0].key).to.equal(helloKey) + + i++ + if (i === 2) done() + } + + pull( + pull.values([b]), + repo.blockstore.putStream(), + pull.collect(finish) + ) + + pull( + pull.values([b]), + repo.blockstore.putStream(), + pull.collect(finish) + ) + }) + + it('massive multiwrite', (done) => { + parallel(_.range(50).map(() => (cb) => { + pull( + pull.values(blockCollection), + repo.blockstore.putStream(), + pull.collect((err, meta) => { + expect(err).to.not.exist + expect(meta).to.have.length(100) + cb() + }) + ) + }), done) + }) + + it('custom extension', function (done) { + const b = new Block('hello world 2', 'ipld') + pull( + pull.values([b]), + repo.blockstore.putStream(), + pull.collect((err, meta) => { + expect(err).to.not.exist + expect(meta[0].key).to.be.eql(helloIpldKey) + done() + }) + ) + }) + + it('returns an error on invalid block', (done) => { + pull( + pull.values(['hello']), + repo.blockstore.putStream(), + pull.onEnd((err) => { + expect(err.message).to.be.eql('Invalid block') + done() + }) + ) + }) + }) + + describe('.getStream', () => { + it('simple', (done) => { + const b = new Block('hello world') + + pull( + repo.blockstore.getStream(b.key), + pull.collect((err, data) => { + expect(err).to.not.exist + expect(data[0]).to.be.eql(b) + + done() + }) + ) + }) + + it('massive read', (done) => { + parallel(_.range(20 * 100).map((i) => (cb) => { + const j = i % 20 + pull( + repo.blockstore.getStream(blockCollection[j].key), + pull.collect((err, meta) => { + expect(err).to.not.exist + expect(meta).to.be.eql([blockCollection[j]]) + cb() + }) + ) + }), done) + }) + + it('custom extension', (done) => { + const b = new Block('hello world 2', 'ipld') + + pull( + repo.blockstore.getStream(b.key, b.extension), + pull.collect((err, data) => { + expect(err).to.not.exist + expect(data[0]).to.be.eql(b) + + done() + }) + ) + }) + + it('returns an error on invalid block', (done) => { + pull( + repo.blockstore.getStream(), + pull.onEnd((err) => { + expect(err.message).to.be.eql('Invalid key') + done() + }) + ) + }) + }) + + describe('.has', () => { + it('existing block', (done) => { + const b = new Block('hello world') + + repo.blockstore.has(b.key, (err, exists) => { + expect(err).to.not.exist + expect(exists).to.equal(true) + done() + }) + }) + + it('with extension', (done) => { + const b = new Block('hello world') + + repo.blockstore.has(b.key, 'data', (err, exists) => { + expect(err).to.not.exist + expect(exists).to.equal(true) + done() + }) + }) + + it('non existent block', (done) => { + const b = new Block('wooot') + + repo.blockstore.has(b.key, (err, exists) => { + expect(err).to.not.exist + expect(exists).to.equal(false) + done() + }) + }) + }) + + describe('.delete', () => { + it('simple', (done) => { + const b = new Block('hello world') + + repo.blockstore.delete(b.key, (err) => { + expect(err).to.not.exist + + repo.blockstore.has(b.key, (err, exists) => { + expect(err).to.not.exist + expect(exists).to.equal(false) + done() + }) + }) + }) + + it('custom extension', (done) => { + const b = new Block('hello world', 'ipld') + + repo.blockstore.delete(b.key, b.extension, (err) => { + expect(err).to.not.exist + + repo.blockstore.has(b.key, b.extension, (err, exists) => { + expect(err).to.not.exist + expect(exists).to.equal(false) + done() + }) + }) + }) + }) + + describe('interop', () => { + it('reads welcome-to-ipfs', (done) => { + const welcomeHash = mh.fromHexString( + '1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec' + ) + pull( + repo.blockstore.getStream(welcomeHash), + pull.collect((err, blocks) => { + expect(err).to.not.exist + expect( + blocks[0].data.toString() + ).to.match( + /Hello and Welcome to IPFS/ + ) + done() + }) + ) + }) + }) + }) +} diff --git a/test/browser.js b/test/browser.js index 42dc4e61..2b716224 100644 --- a/test/browser.js +++ b/test/browser.js @@ -2,11 +2,13 @@ 'use strict' -const eachSeries = require('async/eachSeries') -const store = require('idb-plus-blob-store') -const tests = require('./repo-test') +const series = require('run-series') +const Store = require('idb-pull-blob-store') const _ = require('lodash') +const pull = require('pull-stream') + const IPFSRepo = require('../src') +const tests = require('./repo-test') const repoContext = require.context('buffer!./test-repo', true) @@ -29,10 +31,10 @@ 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') - eachSeries(repoData, (file, cb) => { + series(repoData.map((file) => (cb) => { if (_.startsWith(file.key, 'datastore/')) { return cb() } @@ -42,23 +44,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) - }, done) + pull( + pull.values([file.value]), + blob.write(key, cb) + ) + }), done) }) - const options = { - stores: { - keys: store, - config: store, - datastore: store, - // datastoreLegacy: needs https://github.com/ipfs/js-ipfs-repo/issues/6#issuecomment-164650642 - logs: store, - locks: store, - version: store - } - } - const repo = new IPFSRepo('ipfs', options) + const repo = new IPFSRepo('ipfs', {stores: Store}) tests(repo) }) diff --git a/test/node.js b/test/node.js index d7b28f8e..144eb52d 100644 --- a/test/node.js +++ b/test/node.js @@ -6,6 +6,7 @@ const expect = require('chai').expect const ncp = require('ncp').ncp const rimraf = require('rimraf') const path = require('path') +const Store = require('fs-pull-blob-store') const IPFSRepo = require('../src') @@ -28,7 +29,6 @@ describe('IPFS Repo Tests on on Node.js', () => { }) }) - const fs = require('fs-blob-store') - const repo = new IPFSRepo(repoPath, {stores: fs}) + const repo = new IPFSRepo(repoPath, {stores: Store}) require('./repo-test')(repo) }) diff --git a/test/repo-test.js b/test/repo-test.js index 5474fcc8..39ec5064 100644 --- a/test/repo-test.js +++ b/test/repo-test.js @@ -1,37 +1,25 @@ /* eslint-env mocha */ - 'use strict' -const Repo = require('../src/index') const expect = require('chai').expect -const Block = require('ipfs-block') +const series = require('run-series') -module.exports = function (repo) { - describe('IPFS Repo Tests', function () { - it('can init repo /wo new', (done) => { - var repo - function run () { - repo = Repo('foo', { stores: require('abstract-blob-store') }) - } - expect(run).to.not.throw(Error) - expect(repo).to.be.an.instanceof(Repo) - done() - }) +const Repo = require('../src/index') - it('bad repo init 1', (done) => { - function run () { - return new Repo() - } - expect(run).to.throw(Error) - done() - }) +module.exports = (repo) => { + describe('IPFS Repo Tests', () => { + describe('init', () => { + it('bad repo init 1', () => { + expect( + () => new Repo() + ).to.throw(Error) + }) - it('bad repo init 2', (done) => { - function run () { - return new Repo('', {}) - } - expect(run).to.throw(Error) - done() + it('bad repo init 2', () => { + expect( + () => new Repo('', {}) + ).to.throw(Error) + }) }) it('check if Repo exists', (done) => { @@ -43,37 +31,29 @@ module.exports = function (repo) { }) it('exposes the path', () => { - expect(typeof repo.path).to.be.equal('string') + expect(repo.path).to.be.a('string') }) describe('locks', () => { it('lock, unlock', (done) => { - repo.locks.lock((err) => { - expect(err).to.not.exist - repo.locks.unlock((err) => { - expect(err).to.not.exist - done() - }) - }) + series([ + (cb) => repo.locks.lock(cb), + (cb) => repo.locks.unlock(cb) + ], done) }) it('lock, lock', (done) => { - repo.locks.lock((err) => { - expect(err).to.not.exist - repo.locks.lock((err) => { + series([ + (cb) => repo.locks.lock(cb), + (cb) => repo.locks.lock(cb), + (cb) => repo.locks.unlock(cb) + ], done) + + setTimeout(() => { + repo.locks.unlock((err) => { expect(err).to.not.exist - repo.locks.unlock((err) => { - expect(err).to.not.exist - done() - }) }) - - setTimeout(() => { - repo.locks.unlock((err) => { - expect(err).to.not.exist - }) - }, 500) - }) + }, 500) }) }) @@ -97,14 +77,14 @@ module.exports = function (repo) { }) it('set config', (done) => { - repo.config.set({a: 'b'}, (err) => { - expect(err).to.not.exist - repo.config.get((err, config) => { - expect(err).to.not.exist + series([ + (cb) => repo.config.set({a: 'b'}, cb), + (cb) => repo.config.get((err, config) => { + if (err) return cb(err) expect(config).to.deep.equal({a: 'b'}) - done() + cb() }) - }) + ], done) }) }) @@ -130,153 +110,8 @@ module.exports = function (repo) { }) }) - describe('datastore', function () { - const helloKey = '1220b94d/1220b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9.data' - const helloIpldKey = '1220ed12/1220ed12932f3ef94c0792fbc55263968006e867e522cf9faa88274340a2671d4441.ipld' - - describe('.put', () => { - it('simple', function (done) { - const b = new Block('hello world') - repo.datastore.put(b, (err, meta) => { - expect(err).to.not.exist - expect(meta.key).to.be.eql(helloKey) - done() - }) - }) - - it('multi write (locks)', (done) => { - const b = new Block('hello world') - - let i = 0 - const finish = () => { - i++ - if (i === 2) done() - } - - repo.datastore.put(b, (err, meta) => { - expect(err).to.not.exist - expect(meta.key).to.equal(helloKey) - finish() - }) - - repo.datastore.put(b, (err, meta) => { - expect(err).to.not.exist - expect(meta.key).to.equal(helloKey) - finish() - }) - }) - - it('custom extension', function (done) { - const b = new Block('hello world 2', 'ipld') - repo.datastore.put(b, (err, meta) => { - expect(err).to.not.exist - expect(meta.key).to.be.eql(helloIpldKey) - done() - }) - }) - - it('returns an error on invalid block', (done) => { - repo.datastore.put('hello', (err) => { - expect(err.message).to.be.eql('Invalid block') - done() - }) - }) - }) - - describe('.get', () => { - it('simple', (done) => { - const b = new Block('hello world') - - repo.datastore.get(b.key, (err, data) => { - expect(err).to.not.exist - expect(data).to.be.eql(b) - - done() - }) - }) - - it('custom extension', (done) => { - const b = new Block('hello world 2', 'ipld') - - repo.datastore.get(b.key, b.extension, (err, data) => { - expect(err).to.not.exist - expect(data).to.be.eql(b) - - done() - }) - }) - - it('returns an error on invalid block', (done) => { - repo.datastore.get(null, (err) => { - expect(err.message).to.be.eql('Invalid key') - done() - }) - }) - }) - - describe('.has', () => { - it('existing block', (done) => { - const b = new Block('hello world') - - repo.datastore.has(b.key, (err, exists) => { - expect(err).to.not.exist - expect(exists).to.equal(true) - done() - }) - }) - - it('with extension', (done) => { - const b = new Block('hello world') - - repo.datastore.has(b.key, 'data', (err, exists) => { - expect(err).to.not.exist - expect(exists).to.equal(true) - done() - }) - }) - - it('non existent block', (done) => { - const b = new Block('wooot') - - repo.datastore.has(b.key, (err, exists) => { - expect(err).to.not.exist - expect(exists).to.equal(false) - done() - }) - }) - }) - - describe('.delete', () => { - it('simple', (done) => { - const b = new Block('hello world') - - repo.datastore.delete(b.key, (err) => { - expect(err).to.not.exist - - repo.datastore.has(b.key, (err, exists) => { - expect(err).to.not.exist - expect(exists).to.equal(false) - done() - }) - }) - }) - - it('custom extension', (done) => { - const b = new Block('hello world', 'ipld') - - repo.datastore.delete(b.key, b.extension, (err) => { - expect(err).to.not.exist - - repo.datastore.has(b.key, b.extension, (err, exists) => { - expect(err).to.not.exist - expect(exists).to.equal(false) - done() - }) - }) - }) - }) - }) + require('./blockstore-test')(repo) - describe('datastore-legacy', () => {}) + describe('datastore', () => {}) }) } diff --git a/test/test-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.ext b/test/test-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.ext deleted file mode 100644 index 74de75af..00000000 Binary files a/test/test-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.ext and /dev/null differ 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/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/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/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/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/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/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 875cf233..6ba31a31 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 863b68fd..fc361eb9 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 16, 2016 (CEST) =============== +12:27:26.257958 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +12:27:26.258463 db@open opening +12:27:26.260891 db@janitor F·4 G·0 +12:27:26.260933 db@open done T·2.438178ms diff --git a/test/test-repo/datastore/LOG.old b/test/test-repo/datastore/LOG.old index 708351e7..863b68fd 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 6af3b545..00000000 Binary files a/test/test-repo/datastore/MANIFEST-000007 and /dev/null differ diff --git a/test/test-repo/datastore/MANIFEST-000009 b/test/test-repo/datastore/MANIFEST-000009 new file mode 100644 index 00000000..a69b18a4 Binary files /dev/null and b/test/test-repo/datastore/MANIFEST-000009 differ diff --git a/test/test-repo/version b/test/test-repo/version index 00750edc..b8626c4c 100644 --- a/test/test-repo/version +++ b/test/test-repo/version @@ -1 +1 @@ -3 +4