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 @@ +dtypedipfsfparamsgaddressx1zdpuAuhwhxGZSjWRqPBxfKoPEyF9gZHbKXvGqNtK9TEPJtj67 \ 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 0000000..13521ea Binary files /dev/null and b/test/fixtures/ipfs/blocks/75/CIQMUSJFXRZX7ZRBICXJQPHVD7YSPD5KS75DRO7Q55ADVNORRBXV75Y.data differ 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/` +- 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_directV2 +" eI\(&PD +  2hO.߃o recursiveV \ 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 0000000..e1cd3e3 Binary files /dev/null and b/test/fixtures/ipfs/blocks/K5/CIQPW4MAGTUNEBGZCEFZU7XAJL2BMIHGVB5ZR2IOKOSTRMLIKPB6K5I.data differ 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 + + +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 + ipfs ls /bar + ipfs cat /baz + ipfs cat /bar/baz + ipfs cat /bar + ipfs ls /baz + + +References: + + ipfs refs + ipfs refs -r + ipfs refs --help + + +Get: + + ipfs get -o foo2 + diff foo foo2 + + +Objects: + + ipfs object get + ipfs object get /foo2 + ipfs object --help + + +Pin + GC: + + ipfs pin add + ipfs repo gc + ipfs ls + ipfs pin rm + ipfs repo gc + + +Daemon: + + ipfs daemon (in another terminal) + ipfs id + + +Network: + + (must be online) + ipfs swarm peers + ipfs id + ipfs cat + + +Mount: + + (warning: fuse is finicky!) + ipfs mount + cd /ipfs/ + 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-testckeyx040d2ae7ff5f52d41f65829f30b66eb2c85910f0c683d73ee3cead5d22c15702f32105cdfd83b031d6b2fa594d6ff725979e83bd23575dd26546ff1f30702eb507csigx30440220328dedc06e17fb1a9cb9826c4daa1b5b8e9e609121d025389fccc49ce81787dc02202ea8ea8a691f8896c79bca42f5eba864daba5e920480c95cb88841d76e815308dhashdnexteclockbidx040d2ae7ff5f52d41f65829f30b66eb2c85910f0c683d73ee3cead5d22c15702f32105cdfd83b031d6b2fa594d6ff725979e83bd23575dd26546ff1f30702eb507dtimegpayloadbopcPUTckeyckeyevalueevaluehidentitybidxB02b1a8717e8bdb12c29dae1a43ed83bc7621205c5ba3029a0ca842653c4a5a89d4dtypegorbitdbipublicKeyx040d2ae7ff5f52d41f65829f30b66eb2c85910f0c683d73ee3cead5d22c15702f32105cdfd83b031d6b2fa594d6ff725979e83bd23575dd26546ff1f30702eb507jsignaturesbidx304402200190b97ab06a0623a0fc0d9d7da60ff77515f0649a93d6a9dab3f3bd3bbfb4da02200520284db952c6f0a366b886b881ea5da5bd21a9c277f7d4d4fab1aa8e15682eipublicKeyx3045022100c5e18a43dd47f915754ff964ff2c7f85dbc0a2827964553d648cf613baff6e4b02206e678964e12f8c1532b8d09116a9dc4dadf97b29e21199644b0130e39192259d \ 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 +" sL`>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;fqaU 0 [X@8ӷOindex + \ 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 0000000..afeac9f Binary files /dev/null and b/test/fixtures/ipfs/blocks/WG/CIQN2ZNT35EZ4XBIEYMFARFMBIEICCIO6SVSAMQB7VUE6LW7QNX3WGQ.data differ 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 .data. Where 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 0000000..6c9580d Binary files /dev/null and b/test/fixtures/ipfs/datastore/000202.log differ 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 53b0f66..0000000 Binary files a/test/fixtures/ipfs/datastore/MANIFEST-000200 and /dev/null differ diff --git a/test/fixtures/ipfs/datastore/MANIFEST-000201 b/test/fixtures/ipfs/datastore/MANIFEST-000201 new file mode 100644 index 0000000..b1324be Binary files /dev/null and b/test/fixtures/ipfs/datastore/MANIFEST-000201 differ 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 @@ + Y9_)a˹2RmŖke9 \ 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 0000000..a1eb1d0 Binary files /dev/null and b/test/fixtures/migration/cache-schema-test/000003.log differ 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 0000000..bbbc585 Binary files /dev/null and b/test/fixtures/migration/cache-schema-test/MANIFEST-000002 differ