From e793edf9cf2ee45e5ef4c656541d06becac75a67 Mon Sep 17 00:00:00 2001
From: Mark Henderson <henderson.mark@gmail.com>
Date: Sat, 31 Aug 2019 23:01:17 -0400
Subject: [PATCH] Preliminary cache migration code

cache loading test

this.attemptMigration

Migration data and cleanup

Linting

IPFS data

Revert "Linting"

This reverts commit e41bc4a9ec2011716300134f985c7ec749743177.

Revert "IPFS data"

This reverts commit 299e0b7b72d74cdbaec80ad0796211790404e4c3.

Better fixtures

package-lock.json

Test for directory options

directory option working

Fixing eventlog tests

Safer migration

Moving to migrations folder

Linting
---
 package-lock.json                             |  20 +--
 src/OrbitDB.js                                |  16 ++-
 src/migrations/0.21-0.22.js                   |  44 +++++++
 src/migrations/index.js                       |  11 ++
 test/create-open.test.js                      |  37 +++++-
 ...JMCTWQYYTU6KL2LJKCTWOYTJBA5AOZPLQZ37I.data |   1 +
 ...XJQPHVD7YSPD5KS75DRO7Q55ADVNORRBXV75Y.data | Bin 0 -> 10765 bytes
 ...7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data |  55 +++++++++
 ...ON44WRYG6HNBFWVD2TSZ3F2EW3O4JCJM62EBE.data |   1 +
 ...VPZNQ6C4TJVSVGFTWWOTHP7GWZYGDUP5HIEXY.data |   4 +
 ...AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data |   8 ++
 ...FZU7XAJL2BMIHGVB5ZR2IOKOSTRMLIKPB6K5I.data | Bin 0 -> 402 bytes
 ...7A4KKQZUFSOTOC6DAPPMYXUEKAFGYVNXDULDA.data |   3 +
 ...TJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data |   9 ++
 ...RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data | 115 ++++++++++++++++++
 ...OUGKFK27IE33WKGJNDW2TY3LSBNQ34R6OVOOQ.data |  27 ++++
 ...WYQZTRR5QVLP7VBQYAYW2Y5BAPOOGTW5H2PJQ.data |   3 +
 ...ML4UD5A3R4QRAVBI7NVH3PL64D3IJCWR2SPUQ.data |  36 ++++++
 ...53GWB2UO5IPUJ6NEVKSHUSS77S2NE2PBMAQ7Y.data |   1 +
 ...GPPLZNZOMHHZVIU76LCD5GF5DWFPEGEKODQPI.data |   4 +
 ...57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data |   0
 ...JOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data |  28 +++++
 ...OV2GWVMLAJPVEUMDMFKJZE7CMZESO6TYFAS2I.data |   3 +
 test/fixtures/ipfs/blocks/SHARDING            |   1 +
 ...MFARFMBIEICCIO6SVSAMQB7VUE6LW7QNX3WGQ.data | Bin 0 -> 10807 bytes
 ...2BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data |   2 +
 test/fixtures/ipfs/blocks/_README             |  22 ++++
 test/fixtures/ipfs/config                     |  86 +++++++++++++
 test/fixtures/ipfs/datastore/000202.log       | Bin 0 -> 1699 bytes
 test/fixtures/ipfs/datastore/CURRENT          |   2 +-
 test/fixtures/ipfs/datastore/LOCK             |   0
 test/fixtures/ipfs/datastore/LOG              |   1 +
 test/fixtures/ipfs/datastore/MANIFEST-000200  | Bin 338 -> 0 bytes
 test/fixtures/ipfs/datastore/MANIFEST-000201  | Bin 0 -> 347 bytes
 test/fixtures/ipfs/datastore_spec             |   1 +
 test/fixtures/ipfs/local/filesroot            |   1 +
 test/fixtures/ipfs/version                    |   1 +
 .../migration/cache-schema-test/000003.log    | Bin 0 -> 1579 bytes
 .../migration/cache-schema-test/CURRENT       |   1 +
 .../fixtures/migration/cache-schema-test/LOCK |   0
 test/fixtures/migration/cache-schema-test/LOG |   1 +
 .../cache-schema-test/MANIFEST-000002         | Bin 0 -> 50 bytes
 42 files changed, 532 insertions(+), 13 deletions(-)
 create mode 100644 src/migrations/0.21-0.22.js
 create mode 100644 src/migrations/index.js
 create mode 100644 test/fixtures/ipfs/blocks/37/AFYREIGEZABRNOE6V4RSCJMCTWQYYTU6KL2LJKCTWOYTJBA5AOZPLQZ37I.data
 create mode 100644 test/fixtures/ipfs/blocks/75/CIQMUSJFXRZX7ZRBICXJQPHVD7YSPD5KS75DRO7Q55ADVNORRBXV75Y.data
 create mode 100644 test/fixtures/ipfs/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data
 create mode 100644 test/fixtures/ipfs/blocks/EB/AFYREIADGAKFPY3JU6XSXON44WRYG6HNBFWVD2TSZ3F2EW3O4JCJM62EBE.data
 create mode 100644 test/fixtures/ipfs/blocks/EX/CIQKA7ZA5YM6KOJE3HVPZNQ6C4TJVSVGFTWWOTHP7GWZYGDUP5HIEXY.data
 create mode 100644 test/fixtures/ipfs/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data
 create mode 100644 test/fixtures/ipfs/blocks/K5/CIQPW4MAGTUNEBGZCEFZU7XAJL2BMIHGVB5ZR2IOKOSTRMLIKPB6K5I.data
 create mode 100644 test/fixtures/ipfs/blocks/LD/AFYREIEJ6OCQYIZGCLLSC7A4KKQZUFSOTOC6DAPPMYXUEKAFGYVNXDULDA.data
 create mode 100644 test/fixtures/ipfs/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data
 create mode 100644 test/fixtures/ipfs/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data
 create mode 100644 test/fixtures/ipfs/blocks/OO/CIQBT4N7PS5IZ5IG2ZOUGKFK27IE33WKGJNDW2TY3LSBNQ34R6OVOOQ.data
 create mode 100644 test/fixtures/ipfs/blocks/PJ/CIQB4F7VKKQDXHMXX6WYQZTRR5QVLP7VBQYAYW2Y5BAPOOGTW5H2PJQ.data
 create mode 100644 test/fixtures/ipfs/blocks/PU/CIQJF2E6OPOEYYEVHYML4UD5A3R4QRAVBI7NVH3PL64D3IJCWR2SPUQ.data
 create mode 100644 test/fixtures/ipfs/blocks/Q7/AFYREIH4NIL4YJSM5BYKR53GWB2UO5IPUJ6NEVKSHUSS77S2NE2PBMAQ7Y.data
 create mode 100644 test/fixtures/ipfs/blocks/QP/CIQNLGENZXNRUMUHZYGPPLZNZOMHHZVIU76LCD5GF5DWFPEGEKODQPI.data
 create mode 100644 test/fixtures/ipfs/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data
 create mode 100644 test/fixtures/ipfs/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data
 create mode 100644 test/fixtures/ipfs/blocks/S2/CIQPF3CHDB5GQ5ZBISOV2GWVMLAJPVEUMDMFKJZE7CMZESO6TYFAS2I.data
 create mode 100644 test/fixtures/ipfs/blocks/SHARDING
 create mode 100644 test/fixtures/ipfs/blocks/WG/CIQN2ZNT35EZ4XBIEYMFARFMBIEICCIO6SVSAMQB7VUE6LW7QNX3WGQ.data
 create mode 100644 test/fixtures/ipfs/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data
 create mode 100644 test/fixtures/ipfs/blocks/_README
 create mode 100644 test/fixtures/ipfs/config
 create mode 100644 test/fixtures/ipfs/datastore/000202.log
 create mode 100644 test/fixtures/ipfs/datastore/LOCK
 create mode 100644 test/fixtures/ipfs/datastore/LOG
 delete mode 100644 test/fixtures/ipfs/datastore/MANIFEST-000200
 create mode 100644 test/fixtures/ipfs/datastore/MANIFEST-000201
 create mode 100644 test/fixtures/ipfs/datastore_spec
 create mode 100644 test/fixtures/ipfs/local/filesroot
 create mode 100644 test/fixtures/ipfs/version
 create mode 100644 test/fixtures/migration/cache-schema-test/000003.log
 create mode 100644 test/fixtures/migration/cache-schema-test/CURRENT
 create mode 100644 test/fixtures/migration/cache-schema-test/LOCK
 create mode 100644 test/fixtures/migration/cache-schema-test/LOG
 create mode 100644 test/fixtures/migration/cache-schema-test/MANIFEST-000002

diff --git a/package-lock.json b/package-lock.json
index ff60767..c4c04fc 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "orbit-db",
-  "version": "0.21.4",
+  "version": "0.22.0-rc2",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -157,9 +157,9 @@
       }
     },
     "@hapi/hoek": {
-      "version": "8.2.1",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.1.tgz",
-      "integrity": "sha512-JPiBy+oSmsq3St7XlipfN5pNA6bDJ1kpa73PrK/zR29CVClDVqy04AanM/M/qx5bSF+I61DdCfAvRrujau+zRg==",
+      "version": "8.2.2",
+      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.2.2.tgz",
+      "integrity": "sha512-18P3VwngjNEcmvPj1mmiHLPyUPjhPAxIyJKDj4PRIY0F5ac3P0Vd0hkASPyWXHK0rfY3P9N2FoxV8ZuYaRBZ1g==",
       "dev": true
     },
     "@hapi/inert": {
@@ -3953,9 +3953,9 @@
       }
     },
     "electron-to-chromium": {
-      "version": "1.3.246",
-      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.246.tgz",
-      "integrity": "sha512-CzR7VM16UmZQVgd5I5qu/rx0e67l6FF17rpJD2kRFX9n1ygHFIS+TV9DO55MSZKBGVuQ0Ph1JLLTFEReCKU6nQ==",
+      "version": "1.3.248",
+      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.248.tgz",
+      "integrity": "sha512-+hQe6xqpODLw9Nr80KoT0/S+YarjNbI9wgZchkOopJLBLPgAsniK184P0IGVs/0NsoZf4lBnQhOsjen9a47Hrg==",
       "dev": true
     },
     "elliptic": {
@@ -11816,9 +11816,9 @@
       "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
     },
     "nanoid": {
-      "version": "2.0.4",
-      "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.0.4.tgz",
-      "integrity": "sha512-sOJnBmY3TJQBVIBqKHoifuwygrocXg3NjS9rZSMnVl05XWSHK7Qxb177AIZQyMDjP86bz+yneozj/h9qsPLcCA==",
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.0.tgz",
+      "integrity": "sha512-g5WwS+p6Cm+zQhO2YOpRbQThZVnNb7DDq74h8YDCLfAGynrEOrbx2E16dc8ciENiP1va5sqaAruqn2sN+xpkWg==",
       "dev": true
     },
     "nanomatch": {
diff --git a/src/OrbitDB.js b/src/OrbitDB.js
index 160e4f3..2defcfd 100644
--- a/src/OrbitDB.js
+++ b/src/OrbitDB.js
@@ -18,6 +18,7 @@ const exchangeHeads = require('./exchange-heads')
 const { isDefined, io } = require('./utils')
 const Storage = require('orbit-db-storage-adapter')
 const leveldown = require('leveldown')
+const migrations = require('./migrations')
 
 const Logger = require('logplease')
 const logger = Logger.create('orbit-db')
@@ -303,6 +304,8 @@ class OrbitDB {
 
     if (haveDB && !options.overwrite) { throw new Error(`Database '${dbAddress}' already exists!`) }
 
+    await this._migrate(options, dbAddress)
+
     // Save the database locally
     await this._addManifestToCache(options.cache, dbAddress)
 
@@ -395,10 +398,21 @@ class OrbitDB {
     if (!cache) {
       return false
     }
-    const data = await cache.get(path.join(dbAddress.toString(), '_manifest'))
+
+    const addr = dbAddress.toString()
+    const data = await cache.get(path.join(addr, '_manifest'))
     return data !== undefined && data !== null
   }
 
+  /**
+   * Runs all migrations inside the src/migration folder
+   * @param Object options  Options to pass into the migration
+   * @param OrbitDBAddress dbAddress Address of database in OrbitDBAddress format
+   */
+  async _migrate (options, dbAddress) {
+    await migrations.run(this, options, dbAddress)
+  }
+
   /**
    * Returns supported database types as an Array of strings
    * Eg. [ 'counter', 'eventlog', 'feed', 'docstore', 'keyvalue']
diff --git a/src/migrations/0.21-0.22.js b/src/migrations/0.21-0.22.js
new file mode 100644
index 0000000..0fbbb2a
--- /dev/null
+++ b/src/migrations/0.21-0.22.js
@@ -0,0 +1,44 @@
+const path = require('path')
+const fs = require('fs')
+
+const Cache = require('orbit-db-cache')
+
+const Logger = require('logplease')
+const logger = Logger.create('orbit-db')
+Logger.setLogLevel('ERROR')
+
+async function migrate (OrbitDB, options, dbAddress) {
+  let oldCache = OrbitDB.caches[options.directory]; let oldStore
+
+  if (!oldCache) {
+    const addr = path.join(OrbitDB.directory, dbAddress.root, dbAddress.path)
+    if (fs && fs.existsSync && !fs.existsSync(addr)) return
+    oldStore = await OrbitDB.storage.createStore(addr)
+    oldCache = new Cache(oldStore)
+  }
+  const _localHeads = await oldCache.get('_localHeads')
+  if (!_localHeads) return
+
+  const keyRoot = dbAddress.toString()
+  logger.debug('Attempting to migrate from old cache location')
+  const migrationKeys = [
+    '_remoteHeads',
+    '_localHeads',
+    'snapshot',
+    'queue'
+  ]
+
+  for (let i in migrationKeys) {
+    try {
+      const key = path.join(keyRoot, migrationKeys[i])
+      const val = await oldCache.get(migrationKeys[i])
+      if (val) await options.cache.set(key, val)
+    } catch (e) {
+      logger.debug(e.message)
+    }
+  }
+  await options.cache.set(path.join(keyRoot, '_manifest'), dbAddress.root)
+  if (oldStore) await oldStore.close()
+}
+
+module.exports = migrate
diff --git a/src/migrations/index.js b/src/migrations/index.js
new file mode 100644
index 0000000..18a7f59
--- /dev/null
+++ b/src/migrations/index.js
@@ -0,0 +1,11 @@
+const from021To022 = require('./0.21-0.22')
+
+const migrations = [from021To022]
+
+async function run (OrbitDB, options, dbAddress) {
+  for (let i = 0; i < migrations.length; i++) {
+    await migrations[i](OrbitDB, options, dbAddress)
+  }
+}
+
+module.exports = { run }
diff --git a/test/create-open.test.js b/test/create-open.test.js
index 174f9b3..daedaf1 100644
--- a/test/create-open.test.js
+++ b/test/create-open.test.js
@@ -2,7 +2,7 @@
 
 const assert = require('assert')
 const mapSeries = require('p-map-series')
-const fs = require('fs')
+const fs = require('fs-extra')
 const path = require('path')
 const rmrf = require('rimraf')
 const levelup = require('levelup')
@@ -22,6 +22,8 @@ const {
 
 const dbPath = './orbitdb/tests/create-open'
 const ipfsPath = './orbitdb/tests/create-open/ipfs'
+const migrationFixturePath = './test/fixtures/migration/cache-schema-test'
+const ipfsFixturesDir = './test/fixtures/ipfs'
 
 Object.keys(testAPIs).forEach(API => {
   describe(`orbit-db - Create & Open (${API})`, function() {
@@ -36,6 +38,8 @@ Object.keys(testAPIs).forEach(API => {
       rmrf.sync(dbPath)
       ipfsd = await startIpfs(API, config.daemon1)
       ipfs = ipfsd.api
+      await fs.copy(path.join(ipfsFixturesDir, 'blocks'), path.join(ipfsd.path, 'blocks'))
+      await fs.copy(path.join(ipfsFixturesDir, 'datastore'), path.join(ipfsd.path, 'datastore'))
       orbitdb = await OrbitDB.createInstance(ipfs, { directory: dbPath })
     })
 
@@ -138,6 +142,37 @@ Object.keys(testAPIs).forEach(API => {
           assert.equal(fs.existsSync(dir), true)
         })
 
+        it('loads cache from previous version of orbit-db', async() => {
+          const dbName = 'cache-schema-test'
+
+          db = await orbitdb.create(dbName, 'keyvalue')
+          const manifestHash = db.address.root
+          const migrationDataPath = path.join(dbPath, manifestHash, dbName)
+
+          await db.load()
+          assert.equal((await db.get('key')), undefined)
+          await db.close()
+          await db.drop()
+
+          await fs.copy(migrationFixturePath, migrationDataPath)
+          db = await orbitdb.create(dbName, 'keyvalue')
+          await db.load()
+
+          assert.equal(manifestHash, db.address.root)
+          assert.equal((await db.get('key')), 'value')
+        })
+
+        it('loads cache from previous version of orbit-db with the directory option', async() => {
+          const dbName = 'cache-schema-test2'
+          const directory = path.join(dbPath, "some-other-place")
+
+          await fs.copy(migrationFixturePath, directory)
+          db = await orbitdb.create(dbName, 'keyvalue', { directory })
+          await db.load()
+
+          assert.equal((await db.get('key')), 'value')
+        })
+
         describe('Access Controller', function() {
           before(async () => {
             if (db) {
diff --git a/test/fixtures/ipfs/blocks/37/AFYREIGEZABRNOE6V4RSCJMCTWQYYTU6KL2LJKCTWOYTJBA5AOZPLQZ37I.data b/test/fixtures/ipfs/blocks/37/AFYREIGEZABRNOE6V4RSCJMCTWQYYTU6KL2LJKCTWOYTJBA5AOZPLQZ37I.data
new file mode 100644
index 0000000..9256c1d
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/37/AFYREIGEZABRNOE6V4RSCJMCTWQYYTU6KL2LJKCTWOYTJBA5AOZPLQZ37I.data
@@ -0,0 +1 @@
+�dtypedipfsfparams�gaddressx1zdpuAuhwhxGZSjWRqPBxfKoPEyF9gZHbKXvGqNtK9TEPJtj67
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/75/CIQMUSJFXRZX7ZRBICXJQPHVD7YSPD5KS75DRO7Q55ADVNORRBXV75Y.data b/test/fixtures/ipfs/blocks/75/CIQMUSJFXRZX7ZRBICXJQPHVD7YSPD5KS75DRO7Q55ADVNORRBXV75Y.data
new file mode 100644
index 0000000000000000000000000000000000000000..13521eaa2afc4f2d29bbcaf637bc04cce7ea2493
GIT binary patch
literal 10765
zcmeIzEeZlr6b8^4lRS$&41x-S4CpqTJV|f|cB|1nh%i6ZEJp1H_n}L$Y0zaD&doPn
zzWbdx57U@E&bOlaj0es8b+0$qe0Ewq*X_PM9_rC{d0E9|m`0nfBq6>-GiXI3(2#~S
zq#+GyNJARZkcKp*Aq{CrLmJYMhBTxh4QWV28q$!4G^8O7X-GpF(vXIKpke5RZra~<
HCdqHU=u7k0

literal 0
HcmV?d00001

diff --git a/test/fixtures/ipfs/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data b/test/fixtures/ipfs/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data
new file mode 100644
index 0000000..627ffcd
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data
@@ -0,0 +1,55 @@
+
+�
�
+                  IPFS -- Inter-Planetary File system
+
+IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas
+from Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bit-
+torrent swarm, exchanging git objects. IPFS provides an interface as simple
+as the HTTP web, but with permanence built in. You can also mount the world
+at /ipfs.
+
+IPFS is a protocol:
+- defines a content-addressed file system
+- coordinates content delivery
+- combines Kademlia + BitTorrent + Git
+
+IPFS is a filesystem:
+- has directories and files
+- mountable filesystem (via FUSE)
+
+IPFS is a web:
+- can be used to view documents like the web
+- files accessible via HTTP at `http://ipfs.io/<path>`
+- browsers or extensions can learn to use `ipfs://` directly
+- hash-addressed content guarantees authenticity
+
+IPFS is modular:
+- connection layer over any network protocol
+- routing layer
+- uses a routing layer DHT (kademlia/coral)
+- uses a path-based naming service
+- uses bittorrent-inspired block exchange
+
+IPFS uses crypto:
+- cryptographic-hash content addressing
+- block-level deduplication
+- file integrity + versioning
+- filesystem-level encryption + signing support
+
+IPFS is p2p:
+- worldwide peer-to-peer file transfers
+- completely decentralized architecture
+- **no** central point of failure
+
+IPFS is a cdn:
+- add a file to the filesystem locally, and it's now available to the world
+- caching-friendly (content-hash naming)
+- bittorrent-based bandwidth distribution
+
+IPFS has a name service:
+- IPNS, an SFS inspired name system
+- global namespace based on PKI
+- serves to build trust chains
+- compatible with other NSes
+- can map DNS, .onion, .bit, etc to IPNS
+�
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/EB/AFYREIADGAKFPY3JU6XSXON44WRYG6HNBFWVD2TSZ3F2EW3O4JCJM62EBE.data b/test/fixtures/ipfs/blocks/EB/AFYREIADGAKFPY3JU6XSXON44WRYG6HNBFWVD2TSZ3F2EW3O4JCJM62EBE.data
new file mode 100644
index 0000000..afeb6b3
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/EB/AFYREIADGAKFPY3JU6XSXON44WRYG6HNBFWVD2TSZ3F2EW3O4JCJM62EBE.data
@@ -0,0 +1 @@
+�dnameqcache-schema-testdtypehkeyvaluepaccessControllerx7/ipfs/zdpuAyfbHMCJgA1fL72eAq6pz7G3qKzGgLNZpnrHRbFexR6Zw
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/EX/CIQKA7ZA5YM6KOJE3HVPZNQ6C4TJVSVGFTWWOTHP7GWZYGDUP5HIEXY.data b/test/fixtures/ipfs/blocks/EX/CIQKA7ZA5YM6KOJE3HVPZNQ6C4TJVSVGFTWWOTHP7GWZYGDUP5HIEXY.data
new file mode 100644
index 0000000..5321bdc
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/EX/CIQKA7ZA5YM6KOJE3HVPZNQ6C4TJVSVGFTWWOTHP7GWZYGDUP5HIEXY.data
@@ -0,0 +1,4 @@
+/
+" �I%�s�!@��<��'����8���@:�шo_�direct�V2
+" �e��I�\(&PD�
+�	�� 2�hO.߃o�	recursive�V
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data b/test/fixtures/ipfs/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data
new file mode 100644
index 0000000..62d1c29
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data
@@ -0,0 +1,8 @@
+
+��Come hang out in our IRC chat room if you have any questions.
+
+Contact the ipfs dev team:
+- Bugs: https://github.com/ipfs/go-ipfs/issues
+- Help: irc.freenode.org/#ipfs
+- Email: dev@ipfs.io
+�
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/K5/CIQPW4MAGTUNEBGZCEFZU7XAJL2BMIHGVB5ZR2IOKOSTRMLIKPB6K5I.data b/test/fixtures/ipfs/blocks/K5/CIQPW4MAGTUNEBGZCEFZU7XAJL2BMIHGVB5ZR2IOKOSTRMLIKPB6K5I.data
new file mode 100644
index 0000000000000000000000000000000000000000..e1cd3e3e21d1e86994739a1b26b18c77aa98f034
GIT binary patch
literal 402
zcmWgA<5Ch*SgK>j#LTl(=<Pq>mjz6J*Z#Z`mUeibke1%>*qt`A@ymo*6O-~wOC)CS
z3K@XZPnu<5V|lBKJN>}4>2CTNRSd^0_H1qVw~ozKk4Ii%i@p$ha(-S(VseSZ2}U6u
zkd9Ap+$E|q$`xJa#!6jHIxzjpl!P0h>MB2GPV&4rkBc)?h$SUIxmdzcNEf7f!hx#t
zsRt!Z1(r>_`1cRLoTvNwA5WALIj242ynT9l>I@;4jMSV0i9<|6CLrZc+a#wsJX~_j
zesNET$<F7xC+8|Jo_P6ooSf4IR&^DzLLu(L(#+&+-QtqOq7sP%yh8dQT|)d>-x#mt
z32eIbQ0}@+=%siAr$efYPh^GMo-cfP`NkU|wxZO;l-yK_a~wkEAPtfq_t)&|`O0=J
z)>&iK^$Wi5P8mg6XI0#KB6hf@e{Q&y5MOa>a%oX!Nu_RHeo1Pv#8gg*cdpLpJ$qZq
tsQnzz_w~A`XB0nMvHZ_Q{$={^NqgFq=2+MYv6SSO7D?P^<6`1q1OQn=pS%D7

literal 0
HcmV?d00001

diff --git a/test/fixtures/ipfs/blocks/LD/AFYREIEJ6OCQYIZGCLLSC7A4KKQZUFSOTOC6DAPPMYXUEKAFGYVNXDULDA.data b/test/fixtures/ipfs/blocks/LD/AFYREIEJ6OCQYIZGCLLSC7A4KKQZUFSOTOC6DAPPMYXUEKAFGYVNXDULDA.data
new file mode 100644
index 0000000..f821ccb
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/LD/AFYREIEJ6OCQYIZGCLLSC7A4KKQZUFSOTOC6DAPPMYXUEKAFGYVNXDULDA.data
@@ -0,0 +1,3 @@
+�ewritexJ[
+  "02b1a8717e8bdb12c29dae1a43ed83bc7621205c5ba3029a0ca842653c4a5a89d4"
+]
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data b/test/fixtures/ipfs/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data
new file mode 100644
index 0000000..71be805
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data
@@ -0,0 +1,9 @@
+
+��Some helpful resources for finding your way around ipfs:
+
+- quick-start: a quick show of various ipfs features.
+- ipfs commands: a list of all commands
+- ipfs --help: every command describes itself
+- https://github.com/ipfs/go-ipfs -- the src repository
+- #ipfs on irc.freenode.org -- the community irc channel
+�
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data b/test/fixtures/ipfs/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data
new file mode 100644
index 0000000..f2bf4f8
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data
@@ -0,0 +1,115 @@
+
+�
�
# 0.1 - Quick Start
+
+This is a set of short examples with minimal explanation. It is meant as
+a "quick start". Soon, we'll write a longer tour :-)
+
+
+Add a file to ipfs:
+
+  echo "hello world" >hello
+  ipfs add hello
+
+
+View it:
+
+  ipfs cat <the-hash-you-got-here>
+
+
+Try a directory:
+
+  mkdir foo
+  mkdir foo/bar
+  echo "baz" > foo/baz
+  echo "baz" > foo/bar/baz
+  ipfs add -r foo
+
+
+View things:
+
+  ipfs ls <the-hash-here>
+  ipfs ls <the-hash-here>/bar
+  ipfs cat <the-hash-here>/baz
+  ipfs cat <the-hash-here>/bar/baz
+  ipfs cat <the-hash-here>/bar
+  ipfs ls <the-hash-here>/baz
+
+
+References:
+
+  ipfs refs <the-hash-here>
+  ipfs refs -r <the-hash-here>
+  ipfs refs --help
+
+
+Get:
+
+  ipfs get <the-hash-here> -o foo2
+  diff foo foo2
+
+
+Objects:
+
+  ipfs object get <the-hash-here>
+  ipfs object get <the-hash-here>/foo2
+  ipfs object --help
+
+
+Pin + GC:
+
+  ipfs pin add <the-hash-here>
+  ipfs repo gc
+  ipfs ls <the-hash-here>
+  ipfs pin rm <the-hash-here>
+  ipfs repo gc
+
+
+Daemon:
+
+  ipfs daemon  (in another terminal)
+  ipfs id
+
+
+Network:
+
+  (must be online)
+  ipfs swarm peers
+  ipfs id
+  ipfs cat <hash-of-remote-object>
+
+
+Mount:
+
+  (warning: fuse is finicky!)
+  ipfs mount
+  cd /ipfs/<the-hash-here>
+  ls
+
+
+Tool:
+
+  ipfs version
+  ipfs update
+  ipfs commands
+  ipfs config --help
+  open http://localhost:5001/webui
+
+
+Browse:
+
+  webui:
+
+    http://localhost:5001/webui
+
+  video:
+
+    http://localhost:8080/ipfs/QmVc6zuAneKJzicnJpfrqCH9gSy6bz54JhcypfJYhGUFQu/play#/ipfs/QmTKZgRNwDNZwHtJSjCp6r5FYefzpULfy37JvMt9DwvXse
+
+  images:
+
+    http://localhost:8080/ipfs/QmZpc3HvfjEXvLWGQPWbHk3AjD5j8NEN4gmFN8Jmrd5g83/cs
+
+  markdown renderer app:
+
+    http://localhost:8080/ipfs/QmX7M9CiYXjVeFnkfVGf3y5ixTZ2ACeSGyL1vBJY1HvQPp/mdown
+�
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/OO/CIQBT4N7PS5IZ5IG2ZOUGKFK27IE33WKGJNDW2TY3LSBNQ34R6OVOOQ.data b/test/fixtures/ipfs/blocks/OO/CIQBT4N7PS5IZ5IG2ZOUGKFK27IE33WKGJNDW2TY3LSBNQ34R6OVOOQ.data
new file mode 100644
index 0000000..7703482
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/OO/CIQBT4N7PS5IZ5IG2ZOUGKFK27IE33WKGJNDW2TY3LSBNQ34R6OVOOQ.data
@@ -0,0 +1,27 @@
+
+�	�	                    IPFS Alpha Security Notes
+
+We try hard to ensure our system is safe and robust, but all software
+has bugs, especially new software. This distribution is meant to be an
+alpha preview, don't use it for anything mission critical.
+
+Please note the following:
+
+- This is alpha software and has not been audited. It is our goal
+  to conduct a proper security audit once we close in on a 1.0 release.
+
+- ipfs is a networked program, and may have serious undiscovered
+  vulnerabilities. It is written in Go, and we do not execute any
+  user provided data. But please point any problems out to us in a
+  github issue, or email security@ipfs.io privately.
+
+- security@ipfs.io GPG key:
+  - 4B9665FB 92636D17 7C7A86D3 50AAE8A9 59B13AF3
+  - https://pgp.mit.edu/pks/lookup?op=get&search=0x50AAE8A959B13AF3
+
+- ipfs uses encryption for all communication, but it's NOT PROVEN SECURE
+  YET!  It may be totally broken. For now, the code is included to make
+  sure we benchmark our operations with encryption in mind. In the future,
+  there will be an "unsafe" mode for high performance intranet apps.
+  If this is a blocking feature for you, please contact us.
+�	
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/PJ/CIQB4F7VKKQDXHMXX6WYQZTRR5QVLP7VBQYAYW2Y5BAPOOGTW5H2PJQ.data b/test/fixtures/ipfs/blocks/PJ/CIQB4F7VKKQDXHMXX6WYQZTRR5QVLP7VBQYAYW2Y5BAPOOGTW5H2PJQ.data
new file mode 100644
index 0000000..0335563
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/PJ/CIQB4F7VKKQDXHMXX6WYQZTRR5QVLP7VBQYAYW2Y5BAPOOGTW5H2PJQ.data
@@ -0,0 +1,3 @@
+
+Index
+
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/PU/CIQJF2E6OPOEYYEVHYML4UD5A3R4QRAVBI7NVH3PL64D3IJCWR2SPUQ.data b/test/fixtures/ipfs/blocks/PU/CIQJF2E6OPOEYYEVHYML4UD5A3R4QRAVBI7NVH3PL64D3IJCWR2SPUQ.data
new file mode 100644
index 0000000..e6ef304
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/PU/CIQJF2E6OPOEYYEVHYML4UD5A3R4QRAVBI7NVH3PL64D3IJCWR2SPUQ.data
@@ -0,0 +1,36 @@
+
+��WIP
+
+# 0.0 - Introduction
+
+Welcome to IPFS! This tour will guide you through a few of the
+features of this tool, and the most common commands. Then, it will
+immerse you into the world of merkledags and the amazing things
+you can do with them.
+
+
+This tour has many parts, and can be taken in different sequences.
+Different people learn different ways, so choose your own adventure:
+
+  To start with the concepts, try:
+  - The Merkle DAG
+  - Data Structures on the Merkle DAG
+  - Representing Files with unixfs
+  - add, cat, ls, refs
+  ...
+
+
+  To start with the examples, try:
+  - add, cat, ls, refs
+  - Representing Files with unixfs
+  - Data Structures on the Merkle DAG
+  - The Merkle DAG
+  ...
+
+
+  To start with the network, try:
+  - IPFS Nodes
+  - Running the daemon
+  - The Swarm
+  - The Web
+�
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/Q7/AFYREIH4NIL4YJSM5BYKR53GWB2UO5IPUJ6NEVKSHUSS77S2NE2PBMAQ7Y.data b/test/fixtures/ipfs/blocks/Q7/AFYREIH4NIL4YJSM5BYKR53GWB2UO5IPUJ6NEVKSHUSS77S2NE2PBMAQ7Y.data
new file mode 100644
index 0000000..8274872
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/Q7/AFYREIH4NIL4YJSM5BYKR53GWB2UO5IPUJ6NEVKSHUSS77S2NE2PBMAQ7Y.data
@@ -0,0 +1 @@
+�avbidxL/orbitdb/zdpuAkdtE84R9iHvk39m3qUJKP3RXD9c9EQJWVsLMXC4sYQFA/cache-schema-testckeyx�040d2ae7ff5f52d41f65829f30b66eb2c85910f0c683d73ee3cead5d22c15702f32105cdfd83b031d6b2fa594d6ff725979e83bd23575dd26546ff1f30702eb507csigx�30440220328dedc06e17fb1a9cb9826c4daa1b5b8e9e609121d025389fccc49ce81787dc02202ea8ea8a691f8896c79bca42f5eba864daba5e920480c95cb88841d76e815308dhash�dnext�eclock�bidx�040d2ae7ff5f52d41f65829f30b66eb2c85910f0c683d73ee3cead5d22c15702f32105cdfd83b031d6b2fa594d6ff725979e83bd23575dd26546ff1f30702eb507dtimegpayload�bopcPUTckeyckeyevalueevaluehidentity�bidxB02b1a8717e8bdb12c29dae1a43ed83bc7621205c5ba3029a0ca842653c4a5a89d4dtypegorbitdbipublicKeyx�040d2ae7ff5f52d41f65829f30b66eb2c85910f0c683d73ee3cead5d22c15702f32105cdfd83b031d6b2fa594d6ff725979e83bd23575dd26546ff1f30702eb507jsignatures�bidx�304402200190b97ab06a0623a0fc0d9d7da60ff77515f0649a93d6a9dab3f3bd3bbfb4da02200520284db952c6f0a366b886b881ea5da5bd21a9c277f7d4d4fab1aa8e15682eipublicKeyx�3045022100c5e18a43dd47f915754ff964ff2c7f85dbc0a2827964553d648cf613baff6e4b02206e678964e12f8c1532b8d09116a9dc4dadf97b29e21199644b0130e39192259d
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/QP/CIQNLGENZXNRUMUHZYGPPLZNZOMHHZVIU76LCD5GF5DWFPEGEKODQPI.data b/test/fixtures/ipfs/blocks/QP/CIQNLGENZXNRUMUHZYGPPLZNZOMHHZVIU76LCD5GF5DWFPEGEKODQPI.data
new file mode 100644
index 0000000..6636930
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/QP/CIQNLGENZXNRUMUHZYGPPLZNZOMHHZVIU76LCD5GF5DWFPEGEKODQPI.data
@@ -0,0 +1,4 @@
+2
+" ��s�L`�>�P}��D
+>ڟo_�=�"�u'�	0.0-intro�
+
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data b/test/fixtures/ipfs/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data
new file mode 100644
index 0000000..e69de29
diff --git a/test/fixtures/ipfs/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data b/test/fixtures/ipfs/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data
new file mode 100644
index 0000000..389e111
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data
@@ -0,0 +1,28 @@
+
+��Hello and Welcome to IPFS!
+
+██╗██████╗ ███████╗███████╗
+██║██╔══██╗██╔════╝██╔════╝
+██║██████╔╝█████╗  ███████╗
+██║██╔═══╝ ██╔══╝  ╚════██║
+██║██║     ██║     ███████║
+╚═╝╚═╝     ╚═╝     ╚══════╝
+
+If you're seeing this, you have successfully installed
+IPFS and are now interfacing with the ipfs merkledag!
+
+ -------------------------------------------------------
+| Warning:                                              |
+|   This is alpha software. Use at your own discretion! |
+|   Much is missing or lacking polish. There are bugs.  |
+|   Not yet secure. Read the security notes for more.   |
+ -------------------------------------------------------
+
+Check out some of the other files in this directory:
+
+  ./about
+  ./help
+  ./quick-start     <-- usage examples
+  ./readme          <-- this file
+  ./security-notes
+�
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/S2/CIQPF3CHDB5GQ5ZBISOV2GWVMLAJPVEUMDMFKJZE7CMZESO6TYFAS2I.data b/test/fixtures/ipfs/blocks/S2/CIQPF3CHDB5GQ5ZBISOV2GWVMLAJPVEUMDMFKJZE7CMZESO6TYFAS2I.data
new file mode 100644
index 0000000..b137a86
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/S2/CIQPF3CHDB5GQ5ZBISOV2GWVMLAJPVEUMDMFKJZE7CMZESO6TYFAS2I.data
@@ -0,0 +1,3 @@
+-
+" �R�;�����fq�aU��0[X�@�8ӷO��index
+
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/SHARDING b/test/fixtures/ipfs/blocks/SHARDING
new file mode 100644
index 0000000..a153331
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/SHARDING
@@ -0,0 +1 @@
+/repo/flatfs/shard/v1/next-to-last/2
diff --git a/test/fixtures/ipfs/blocks/WG/CIQN2ZNT35EZ4XBIEYMFARFMBIEICCIO6SVSAMQB7VUE6LW7QNX3WGQ.data b/test/fixtures/ipfs/blocks/WG/CIQN2ZNT35EZ4XBIEYMFARFMBIEICCIO6SVSAMQB7VUE6LW7QNX3WGQ.data
new file mode 100644
index 0000000000000000000000000000000000000000..afeac9fff900985e656e0ffd12d063e05daa810f
GIT binary patch
literal 10807
zcmeI&uL{Co6o=tW4Dt;`KSTr_j3MX+7_1t_<k%e;Y_cE-!q`2Cu+6Gq5^b6_m~A$}
zKWJZ@LA{HG_vDif=lq^>WL=ojxNVMY|5GW1adZlX`)Y07y7%YP?qU{{$Gx2`m69sy
zWJ+uZ*FiFniim)QXo!Yrh=yp0hG>X}Xo!Yrh=yp0hG>X}Xo!Yrh=yp0hG>X}Xo!Yr
zh=yp0hG>X}XqXrcW5;W}&gn~D3*BocDjLt##D8b4Wpg{Q4v*3Q|5IopqvpJnuKel?
D6)*)k

literal 0
HcmV?d00001

diff --git a/test/fixtures/ipfs/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data b/test/fixtures/ipfs/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data
new file mode 100644
index 0000000..9553a94
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/test/fixtures/ipfs/blocks/_README b/test/fixtures/ipfs/blocks/_README
new file mode 100644
index 0000000..ac3b603
--- /dev/null
+++ b/test/fixtures/ipfs/blocks/_README
@@ -0,0 +1,22 @@
+This is a repository of IPLD objects. Each IPLD object is in a single file,
+named <base32 encoding of cid>.data. Where <base32 encoding of cid> is the
+"base32" encoding of the CID (as specified in
+https://github.com/multiformats/multibase) without the 'B' prefix.
+All the object files are placed in a tree of directories, based on a
+function of the CID. This is a form of sharding similar to
+the objects directory in git repositories. Previously, we used
+prefixes, we now use the next-to-last two charters.
+    func NextToLast(base32cid string) {
+      nextToLastLen := 2
+      offset := len(base32cid) - nextToLastLen - 1
+      return str[offset : offset+nextToLastLen]
+    }
+For example, an object with a base58 CIDv1 of
+    zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f
+has a base32 CIDv1 of
+    BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA
+and will be placed at
+    SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data
+with 'SC' being the last-to-next two characters and the 'B' at the
+beginning of the CIDv1 string is the multibase prefix that is not
+stored in the filename.
diff --git a/test/fixtures/ipfs/config b/test/fixtures/ipfs/config
new file mode 100644
index 0000000..a61da29
--- /dev/null
+++ b/test/fixtures/ipfs/config
@@ -0,0 +1,86 @@
+{
+  "Addresses": {
+    "Swarm": [
+      "/ip4/0.0.0.0/tcp/4002",
+      "/ip4/127.0.0.1/tcp/4003/ws"
+    ],
+    "API": "/ip4/127.0.0.1/tcp/5002",
+    "Gateway": "/ip4/127.0.0.1/tcp/9090"
+  },
+  "Discovery": {
+    "MDNS": {
+      "Enabled": true,
+      "Interval": 10
+    },
+    "webRTCStar": {
+      "Enabled": true
+    }
+  },
+  "Bootstrap": [
+    "/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z",
+    "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
+    "/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
+    "/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm",
+    "/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
+    "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
+    "/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
+    "/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3",
+    "/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx",
+    "/ip6/2604:a880:1:20::1f9:9001/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z",
+    "/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
+    "/ip6/2604:a880:0:1010::23:d001/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm",
+    "/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
+    "/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
+    "/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
+    "/ip6/2a03:b0c0:1:d0::e7:1/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3",
+    "/ip6/2604:a880:1:20::1d9:6001/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx",
+    "/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic",
+    "/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"
+  ],
+  "Swarm": {
+    "ConnMgr": {
+      "LowWater": 200,
+      "HighWater": 500
+    }
+  },
+  "Identity": {
+    "PeerID": "QmZDxp1kbEQTTeWNRN6xGWhH3AxNhR5J1ZspdAgS5JgLXW",
+    "PrivKey": "CAASpwkwggSjAgEAAoIBAQCsopwtbRiWIo/8VJWj5jN+w8rENSb/zpRhkMaPiyTV1KgSMqD5+beOacDH5hYhGOz7pjd7jzXVRrhIKQo6lIyk77aJieW/6Ny34uwYqAiGMZNahXnVhXAE6uLoU49l967/v6YXuKgWOFeOSnAznyIX7guJgN61swJbQ/N32Ho7Vbqykjf4ody5qu3BNTREa4g9TRqxYT8+vh/aHUTI2ze/Z+EwjNfOJVgGbAx9tqxozyiLcH+dHVLD4TKMOJ+s3wQ5TZfe7QaVSUxVUg9L4GYRpvB8GgDPcmAy23G61CYP62BGgU+/e8/fYD44aTfxg53XWt6FNcw0/Mzar9qjHqk3AgMBAAECggEAcRkLBjudyuYTvHTRoBG1FMxCb65+wUHeNdj6LJo05J2wClP+4CW4GmWv9YYIY2CICQlI+frFgtcU7bltSRl+1qNwy8R6rvJof1P75t9Wzkt2ROyC9962l5ImW5w6qsvMayJsNsgz3nLE8aRUw4zycgjyp/+0aAdBePcYbyB0W5/n4lSic9sNG48l7psq6LP6dt7V+AD+rqMYV3bMLPnhUgDeNVP7xILD30xWNbSfaimJfFMypli0K7BQst7tYI0r82rShkxKCEG7CgpzYKrVcXCD90xOEm7ZcUYf1bVtAPNCZ5KoVA7uAULpHd6OxxtQs+Rtg6gfajzyN2YXH/O0aQKBgQDYVkc8aBESDWytAl/4a62OQEX/f43sxqB9+7IxzcaOuSd5Rdn3jmHyi9tP+VLnuyRbXe7OhaWVrZDRdaV3R0TOGK/TdIzNNgfNA81sBAItedrpawVfb6GdXvrrBWOuFej8A5aUYpUY7JEwW8FBVuuM+cq4su5AEjmsIC0+is0AjQKBgQDMSTKoLqJsS3JHXYMsvQp+B2UO7kO8LLQPdM27Wet/1Id3O7jWgN7gEslrOuiqbsfuLlfe9TwiZk9Z9LdNDrUkHHY2XTrLpyEW4XAkZ2oVMqrQZczW8uw7JOwFcVWGnL+P0w3W9YQQjsnRGvje3oGfyRAvH1XGBIGfABc74LtJ0wKBgHUujtmWmSCJKwOv1KIwWUtDX2cdBZhqosZ7DrPRfasTeeFDx+RDOKTzwrDYIWMqSHBBOjidxeqEoHwE2ML6VLe6QYsth5MkoCcZ1yyaIz/U0JI9CST/x7ABobKqMas7bP8NRoRLve1JPv/Nw6mL1n1/VKKlMU59UMX+i+NjtdWFAoGAHYp0NdfQiwJ5+xHttxl7G/Brz7Xqu5pnS1jjqzT8lhagpEBRoUsvb42n7MavAH5WkP3InSgvUvYigWqe2xjGXvtyqLfgmbSIV2uwMMN3lqsmAk7GSUsFmCPlsX/LE1U1alHlzXDhcReE3aUd2fSpH/cOTRIl8CWUrO5xbao4yxsCgYEAsl8M2R7TjKpwoL+a9upZoIz4FDT0h+S3CTQhZSh4juVj/fOnzsMvesdbTb5w8rTg33yN8GLjEHeeLQei6vNxtK875cNsmm8hUIagB0+1IApkvswAJhpM/4gA1G+ZxTgR9pIqSu3iYuaESuEB763PyznmbUiV9a9glY8oSu0WFmU="
+  },
+  "datastore": {
+    "Spec": {
+      "type": "mount",
+      "mounts": [
+        {
+          "mountpoint": "/blocks",
+          "type": "measure",
+          "prefix": "flatfs.datastore",
+          "child": {
+            "type": "flatfs",
+            "path": "blocks",
+            "sync": true,
+            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2"
+          }
+        },
+        {
+          "mountpoint": "/",
+          "type": "measure",
+          "prefix": "leveldb.datastore",
+          "child": {
+            "type": "levelds",
+            "path": "datastore",
+            "compression": "none"
+          }
+        }
+      ]
+    }
+  },
+  "Keychain": {
+    "dek": {
+      "keyLength": 64,
+      "iterationCount": 10000,
+      "salt": "cYS7ZeAxVX7IdDVJ2JDOYNio",
+      "hash": "sha2-512"
+    }
+  }
+}
\ No newline at end of file
diff --git a/test/fixtures/ipfs/datastore/000202.log b/test/fixtures/ipfs/datastore/000202.log
new file mode 100644
index 0000000000000000000000000000000000000000..6c9580db5270c9d2925216d9b7fdefbbedc69f81
GIT binary patch
literal 1699
zcmYcbRa9NV$f(5t0gOP3(N;gRAg@^8*)!1F#Xlg-J1W8`z$nbb+}y*-C@dt%%*Z>y
zE7;84+#}4`)Wp#z$lcq=JH*4o%`G_C!`$;a6PI3KZm6G+PjP^wvvZYUnNLMvSaw8V
zp-+TqkYR+eiD_YBnnzM`nwfb<nWM2^o=^kRjN0&7hXm?N)_Sd3o95>6AX30;n$P4l
ze~uQ{8QgE3d(*I~I_*tUe%<C@8654$%&k5>vX1z~leRtXQ0}2z;oL7=-xT=o%uZMF
zPh?yD;p?OTkCI>Ka%>ysD;+ZOJ!G*%Vi)(4T(*y!7ViIfgX8hF1A1XG_x?*u{jF20
z)LcDPsYCJ+H*4*Vw_Ano^gI7tf4cT!dyGl^_vGX4J^d@r-aY=^W(!N*POD%cqpZ-t
zq?O9Y4ZCY(Cd56Ca?S02683y$n$lJd?t|`?e_YnO#H;R|xASn3@{71;$(J00waf2y
z%sFc@pZlfyPn%zS4;RfoA5`{W%JcOHRr7y8y*~MN!QS14?@S~Zl;n&I3@vpHfXFb!
z(9Fuj#LCc2&(zY=01Tou7-p7lJju+=sEr&|j{0t<p%IS8At7!iUd~RQeo<y&KJMmT
z=H3w@<|ZZ{-r@cp#$H~g?mm&mCT0-<5rIzru2Eio-o7R#q2b=1=BArixild0Eu^q;
z=hv|O<*)YqKPMYj_-)FU)5m_k-uHpKbIMkq=bEX?e}!6EN8^?zaci}jiGx9C8IwU1
zqmltH8>d#AN85K^Mn*<f2IeM4eg>d87gG}>Bg2|Sb98ehrYZIR37NY1nQ`6WQ%6kI
z{-2wYIN?}-x60KkD};;|{QSASFZ00hXJU#HZ+<T`ukJU!>bAo}lgnyK&yx4sIy;~4
ze{pB~qc;*OINA&+N3~X7Z7pDV_2@-#f9m&j|MxEw-?2i>BD~M5z<9or_&e^-hI?B#
zGetXpF27M_9lC4NB=a8&@9bRl_MoYWOLm8?uhhmwd%Jz|w`5&T+&15z{?MT3`Z?7I
zwj7??ZEG^lYjhXX&y@{2{LrY!V*Z-@ESA30@4aQ4>gf|2#P9teO>o(V8YzbJMF~c?
z3wK>n<A0st*66>#`uzO_JBv*7kIi$hN8M{RJ!A6c%&qme7R#+PXJTe#V4PIo7z-@4
zbdYm`9WW<Ex`+Ej2D>^38i$yAhx?g@n1uy+m`6qWhxwWWga?Nh`9=gqM49@V0}Cb-
zui#*#(5R>=FW=B0bE9iaTx$9S+4@9eg3+iVA*w`jn%3DcFzO;l6}Ns)esW@tenDnl
qv67I&f_jB_l20vFZoc}nO-@{G)~RJWZ_|C=|6DsqqNLuhDINg9o6l(g

literal 0
HcmV?d00001

diff --git a/test/fixtures/ipfs/datastore/CURRENT b/test/fixtures/ipfs/datastore/CURRENT
index dec9ae1..6d0c8e6 100644
--- a/test/fixtures/ipfs/datastore/CURRENT
+++ b/test/fixtures/ipfs/datastore/CURRENT
@@ -1 +1 @@
-MANIFEST-000200
+MANIFEST-000201
diff --git a/test/fixtures/ipfs/datastore/LOCK b/test/fixtures/ipfs/datastore/LOCK
new file mode 100644
index 0000000..e69de29
diff --git a/test/fixtures/ipfs/datastore/LOG b/test/fixtures/ipfs/datastore/LOG
new file mode 100644
index 0000000..a428b38
--- /dev/null
+++ b/test/fixtures/ipfs/datastore/LOG
@@ -0,0 +1 @@
+2019/09/01-11:44:16.574088 7fd834d96700 Delete type=3 #200
diff --git a/test/fixtures/ipfs/datastore/MANIFEST-000200 b/test/fixtures/ipfs/datastore/MANIFEST-000200
deleted file mode 100644
index 53b0f661860ec968b3d8b23b58e51ae25de50758..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 338
zcmezHEmXmqk&#g<C$%g!CnZVGsj?)sJhM2}IX|}`u_&=5zliBLBlAf{7EM+L3H_Y>
z<is5Pw9K5;;-dWg5=LbPFkojm%J_g0Q(6-ujZ=c1;Q&^B8o2a9CD<8uW7VgQOCMB%
zopC$kSw2sFH`CAvN8^wXHxn;s$6)6mV<R`$U?1ZU7k?+yD0BC~u&D4r6H`y0sNis4
oS9kxAU?*o6lgM!I5OecjbEgnbMka_w!q5OI$jmEdWPykQ07Z^j)Bpeg

diff --git a/test/fixtures/ipfs/datastore/MANIFEST-000201 b/test/fixtures/ipfs/datastore/MANIFEST-000201
new file mode 100644
index 0000000000000000000000000000000000000000..b1324bebe8e2cf8337a44dcf32c1d215153011bf
GIT binary patch
literal 347
zcmWf0(-d}QWMq`eNi9pwNlDUksw_z@&n!-L&d)7KEJ`fNFJfho(9g+FPR!9y%gjkF
zF3Qg@VN_-S19pa^j1L$wr8ObaI3?H_4q(-%flD7$f}LSER(<NY^g$)q8MiZ@<@3~c
zGYyS!G!6-IGx2hE40aAOHga<f_Aw4|@pm$fGItLQiwX}kG4=F`3J&*mb@vYmc5-$x
xi46A+F*gr3cM9=jWP(^E3=NQi%)DYo7KoV9)z}kU42(>t7&#f3PcyP;0svy)T224}

literal 0
HcmV?d00001

diff --git a/test/fixtures/ipfs/datastore_spec b/test/fixtures/ipfs/datastore_spec
new file mode 100644
index 0000000..7bf9626
--- /dev/null
+++ b/test/fixtures/ipfs/datastore_spec
@@ -0,0 +1 @@
+{"mounts":[{"mountpoint":"/blocks","path":"blocks","shardFunc":"/repo/flatfs/shard/v1/next-to-last/2","type":"flatfs"},{"mountpoint":"/","path":"datastore","type":"levelds"}],"type":"mount"}
\ No newline at end of file
diff --git a/test/fixtures/ipfs/local/filesroot b/test/fixtures/ipfs/local/filesroot
new file mode 100644
index 0000000..541e972
--- /dev/null
+++ b/test/fixtures/ipfs/local/filesroot
@@ -0,0 +1 @@
+ Y��9_)a���˹2�R�m�Ŗke�9��
\ No newline at end of file
diff --git a/test/fixtures/ipfs/version b/test/fixtures/ipfs/version
new file mode 100644
index 0000000..c793025
--- /dev/null
+++ b/test/fixtures/ipfs/version
@@ -0,0 +1 @@
+7
\ No newline at end of file
diff --git a/test/fixtures/migration/cache-schema-test/000003.log b/test/fixtures/migration/cache-schema-test/000003.log
new file mode 100644
index 0000000000000000000000000000000000000000..a1eb1d01434298868267b0fce51324c250d51605
GIT binary patch
literal 1579
zcmd5+%WfS-5RHKiV$XsN(ySf1yZTk-U4S4fCQ%$EPV6X(s=K=5(S72XYjJOsKgb90
zFMI+!K7b{EfY?%F6NK0yvG7RK-P1L7`kYfW^UD`MZGXJ8w|D2}n&!RJgVkm3N67~}
zS#R#mWW1053H3);Ge-;e{j&$hkKL0O-%z3ZCl8*V4&Oa|@wFe$PQJZ&P`F&wyMqo3
zzB|@oJb1m}W#4q=y8jH<{r=_qKa}1_x0K%JzvB6CpX`17PkNudp05hek1EUX^QSN0
zb{9NcbcfgCzj7xFcXhrx+sw+-qvcR%i}guf@6O)rjvwu4m)iOI(J60^pI`E}+wXeO
z#Q(Dzin-?Pe8md<wp*<g{_(S?x;v{|T~FhFcg6Ef)u)^J-F~;MKaAbs%U2re4()zd
zRN-s_xaMcP5#X9y3oU?n+hRbV=1h*UW+)iQnr2EwC&|_7ih2_SpxBTMGzZp%B2Ca`
z<E+FCjRSd!ttAMQsA@#Og%m^}2Co6D_?ldEFiAO&{X!{QC3~afR*>qYF2{aUXFpg4
z*)k@ZDrU(R3XpKM>|LG2mlVN*dJ!@^1H`5<dKK)7=fFtfrvh&Byf4Ss1-lh8hyKly
z$IWFO{ub(t_XfZiOD0p|Y$BToj!i2@NRn_gTHO?EXeN4MauQkH$gXLvUCu3g;cJWl
z2GC2U03|lVF2;;F-L`TN4%!=*sX$6Ci5K5kZDy=CM1=Y;%amGBSZhoP)uMVY;!`8-
z#o$|`r~{PLFi0+j0U_yL2+Gf6Y0<jOt;Oo|L@w5tP~+7?L+xh=8O4yblbE6kq*2O1
z6|5zFPqVBu)sZF8)|O5?cHFL~&+V_D?zE$h>c$5X9iUVxdX`O1l~Kur5GQoDIb^I<
zqn-&?3<QVNN-3U7MVl~bqVj~QelT(*+fWIYM7gks7HVdU3Y9rj0^`vX3PsIDZzV+q
K3C>{m?$w{KF2=+F

literal 0
HcmV?d00001

diff --git a/test/fixtures/migration/cache-schema-test/CURRENT b/test/fixtures/migration/cache-schema-test/CURRENT
new file mode 100644
index 0000000..1a84852
--- /dev/null
+++ b/test/fixtures/migration/cache-schema-test/CURRENT
@@ -0,0 +1 @@
+MANIFEST-000002
diff --git a/test/fixtures/migration/cache-schema-test/LOCK b/test/fixtures/migration/cache-schema-test/LOCK
new file mode 100644
index 0000000..e69de29
diff --git a/test/fixtures/migration/cache-schema-test/LOG b/test/fixtures/migration/cache-schema-test/LOG
new file mode 100644
index 0000000..66855df
--- /dev/null
+++ b/test/fixtures/migration/cache-schema-test/LOG
@@ -0,0 +1 @@
+2019/09/01-11:44:17.005796 7fd834d96700 Delete type=3 #1
diff --git a/test/fixtures/migration/cache-schema-test/MANIFEST-000002 b/test/fixtures/migration/cache-schema-test/MANIFEST-000002
new file mode 100644
index 0000000000000000000000000000000000000000..bbbc585686bcbcc33686059c69d80b7b4e1291cd
GIT binary patch
literal 50
zcmWIhx#Ncn10$nUPHI_dPD+xVQ)NkNd1i5{bAE0?Vo_pAe$kRS-TOEg7@3$k8JJmE
F7y#sj5K{mE

literal 0
HcmV?d00001