diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0bc3b42d..d401a774 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ updates: schedule: interval: daily time: "10:00" - open-pull-requests-limit: 10 + open-pull-requests-limit: 20 commit-message: prefix: "deps" prefix-development: "deps(dev)" diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index 35d87d10..1d7ff79c 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -9,7 +9,9 @@ on: permissions: contents: write + id-token: write packages: write + pull-requests: write concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} diff --git a/README.md b/README.md index 9e796f7b..1dd9ec84 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# stores + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/package.json b/package.json index 81b7935c..f6902bd1 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,93 @@ "url": "https://github.com/ipfs/js-stores/issues" }, "private": true, + "release": { + "branches": [ + "main" + ], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits", + "releaseRules": [ + { + "breaking": true, + "release": "major" + }, + { + "revert": true, + "release": "patch" + }, + { + "type": "feat", + "release": "minor" + }, + { + "type": "fix", + "release": "patch" + }, + { + "type": "docs", + "release": "patch" + }, + { + "type": "test", + "release": "patch" + }, + { + "type": "deps", + "release": "patch" + }, + { + "scope": "no-release", + "release": false + } + ] + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits", + "presetConfig": { + "types": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "chore", + "section": "Trivial Changes" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "deps", + "section": "Dependencies" + }, + { + "type": "test", + "section": "Tests" + } + ] + } + } + ], + "@semantic-release/changelog", + "@semantic-release/npm", + "@semantic-release/github", + "@semantic-release/git" + ] + }, "scripts": { - "reset": "aegir run clean && aegir clean ./node_modules ./package-lock.json packages/*/node_modules packages/*/package-lock.json packages/*/dist", + "reset": "aegir run clean && aegir clean **/node_modules **/package-lock.json", "test": "aegir run test", "test:node": "aegir run test:node", "test:chrome": "aegir run test:chrome", @@ -23,15 +108,18 @@ "test:electron-main": "aegir run test:electron-main", "test:electron-renderer": "aegir run test:electron-renderer", "clean": "aegir run clean", + "generate": "aegir run generate", "build": "aegir run build", "lint": "aegir run lint", - "docs": "NODE_OPTIONS=--max_old_space_size=8192 aegir docs", - "docs:no-publish": "NODE_OPTIONS=--max_old_space_size=8192 aegir docs --publish false", "dep-check": "aegir run dep-check", - "release": "npm run docs:no-publish && aegir run release --concurrency=1 && npm run docs" + "release": "run-s build docs:no-publish npm:release docs", + "npm:release": "aegir release", + "docs": "aegir docs", + "docs:no-publish": "aegir docs --publish false" }, "devDependencies": { - "aegir": "^41.1.9" + "aegir": "^42.2.3", + "npm-run-all": "^4.1.5" }, "workspaces": [ "packages/*" diff --git a/packages/blockstore-core/README.md b/packages/blockstore-core/README.md index 8ab2013a..715e7c40 100644 --- a/packages/blockstore-core/README.md +++ b/packages/blockstore-core/README.md @@ -1,3 +1,5 @@ +# blockstore-core + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) @@ -5,6 +7,73 @@ > Contains various implementations of the API contract described in interface-blockstore +# About + +Various Blockstore implementations are available. + +## Implementations + +- Base: [`src/base`](src/base.ts) +- Memory: [`src/memory`](src/memory.ts) +- BlackHole: ['src/black-hole](src/black-hole.ts) +- Tiered: ['src/tiered](src/tiered.ts) + +## Example - BaseBlockstore + +Provides a complete implementation of the Blockstore interface. You must implement `.get`, `.put`, etc. + +```js +import { BaseBlockstore } from 'blockstore-core/base' + +class MyCustomBlockstore extends BaseBlockstore { + put (key, val, options) { + // store a block + } + + get (key, options) { + // retrieve a block + } + + // ...etc +} +``` + +## Example - MemoryBlockstore + +A simple Blockstore that stores blocks in memory. + +```js +import { MemoryBlockstore } from 'blockstore-core/memory' + +const store = new MemoryBlockstore() +``` + +## Example - BlackHoleBlockstore + +A Blockstore that does not store any blocks. + +```js +import { BlackHoleBlockstore } from 'blockstore-core/black-hole' + +const store = new BlackHoleBlockstore() +``` + +## Example - TieredBlockstore + +A tiered blockstore wraps one or more blockstores and will query each in parallel to retrieve a block - the operation will succeed if any wrapped store has the block. + +Writes are invoked on all wrapped blockstores. + +```js +import { TieredBlockstore } from 'blockstore-core/tiered' + +const store = new TieredBlockstore([ + store1, + store2, + // ...etc +]) +``` + # Install ```console diff --git a/packages/blockstore-core/package.json b/packages/blockstore-core/package.json index eea6732f..ce5d0cfa 100644 --- a/packages/blockstore-core/package.json +++ b/packages/blockstore-core/package.json @@ -4,7 +4,7 @@ "description": "Contains various implementations of the API contract described in interface-blockstore", "author": "Alex Potsides ", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/blockstore-core#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/blockstore-core#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -12,6 +12,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "datastore", "interface", @@ -75,96 +79,10 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", "build": "aegir build", - "release": "aegir release", "test": "aegir test -t node -t browser -t webworker -t electron-main", "test:node": "aegir test -t node --cov", "test:chrome": "aegir test -t browser --cov", @@ -175,19 +93,19 @@ "dep-check": "aegir dep-check" }, "dependencies": { - "@libp2p/logger": "^4.0.1", + "@libp2p/logger": "^4.0.6", "err-code": "^3.0.1", "interface-blockstore": "^5.0.0", "interface-store": "^5.0.0", - "it-drain": "^3.0.1", - "it-filter": "^3.0.0", - "it-merge": "^3.0.1", - "it-pushable": "^3.0.0", - "multiformats": "^13.0.0", - "uint8arrays": "^5.0.0" + "it-drain": "^3.0.5", + "it-filter": "^3.0.4", + "it-merge": "^3.0.3", + "it-pushable": "^3.2.3", + "multiformats": "^13.0.1" }, "devDependencies": { - "aegir": "^41.1.9", - "interface-blockstore-tests": "^6.0.0" + "aegir": "^42.2.3", + "interface-blockstore-tests": "^6.0.0", + "uint8arrays": "^5.0.2" } } diff --git a/packages/blockstore-fs/README.md b/packages/blockstore-fs/README.md index f2e27373..a7e4b185 100644 --- a/packages/blockstore-fs/README.md +++ b/packages/blockstore-fs/README.md @@ -1,3 +1,5 @@ +# blockstore-fs + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) @@ -5,6 +7,18 @@ > Blockstore implementation with file system backend +# About + +A Blockstore implementation that stores blocks in the local filesystem. + +## Example + +```js +import { FsBlockstore } from 'blockstore-fs' + +const store = new FsBlockstore('path/to/store') +``` + # Install ```console diff --git a/packages/blockstore-fs/package.json b/packages/blockstore-fs/package.json index cb7a1655..d5fe8ce1 100644 --- a/packages/blockstore-fs/package.json +++ b/packages/blockstore-fs/package.json @@ -3,7 +3,7 @@ "version": "1.1.9", "description": "Blockstore implementation with file system backend", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/blockstore-fs#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/blockstore-fs#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "datastore", "fs", @@ -62,96 +66,10 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", "build": "aegir build --bundle false", - "release": "aegir release", "test": "aegir test -t node -t electron-main", "test:node": "aegir test -t node", "test:electron-main": "aegir test -t electron-main", @@ -159,16 +77,16 @@ }, "dependencies": { "blockstore-core": "^4.0.0", - "fast-write-atomic": "^0.2.0", + "fast-write-atomic": "^0.2.1", "interface-blockstore": "^5.0.0", "interface-store": "^5.0.0", - "it-glob": "^2.0.1", - "it-map": "^3.0.1", - "it-parallel-batch": "^3.0.0", - "multiformats": "^13.0.0" + "it-glob": "^2.0.6", + "it-map": "^3.0.5", + "it-parallel-batch": "^3.0.4", + "multiformats": "^13.0.1" }, "devDependencies": { - "aegir": "^41.1.9", + "aegir": "^42.2.3", "interface-blockstore-tests": "^6.0.0" } } diff --git a/packages/blockstore-idb/README.md b/packages/blockstore-idb/README.md index 5e007576..7009d9ac 100644 --- a/packages/blockstore-idb/README.md +++ b/packages/blockstore-idb/README.md @@ -1,3 +1,5 @@ +# blockstore-idb + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/blockstore-idb/package.json b/packages/blockstore-idb/package.json index 5a8d3cbe..e11a504d 100644 --- a/packages/blockstore-idb/package.json +++ b/packages/blockstore-idb/package.json @@ -3,7 +3,7 @@ "version": "1.1.7", "description": "Blockstore implementation with IndexedDB backend", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/blockstore-idb#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/blockstore-idb#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "browser", "datastore", @@ -40,96 +44,10 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", "build": "aegir build", - "release": "aegir release", "test": "aegir test -t browser", "test:chrome": "aegir test -t browser", "test:chrome-webworker": "aegir test -t webworker", @@ -142,10 +60,10 @@ "idb": "^8.0.0", "interface-blockstore": "^5.0.0", "interface-store": "^5.0.0", - "multiformats": "^13.0.0" + "multiformats": "^13.0.1" }, "devDependencies": { - "aegir": "^41.1.9", + "aegir": "^42.2.3", "interface-blockstore-tests": "^6.0.0" } } diff --git a/packages/blockstore-level/README.md b/packages/blockstore-level/README.md index 6434601f..a7cdfd73 100644 --- a/packages/blockstore-level/README.md +++ b/packages/blockstore-level/README.md @@ -1,3 +1,5 @@ +# blockstore-level + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/blockstore-level/package.json b/packages/blockstore-level/package.json index 8903a2b4..240fe2fb 100644 --- a/packages/blockstore-level/package.json +++ b/packages/blockstore-level/package.json @@ -3,7 +3,7 @@ "version": "1.1.7", "description": "Blockstore implementation with level(up|down) backend", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/blockstore-level#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/blockstore-level#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "blockstore", "interface", @@ -41,96 +45,10 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", "build": "aegir build", - "release": "aegir release", "test": "aegir test", "test:node": "aegir test -t node --cov", "test:chrome": "aegir test -t browser --cov", @@ -144,13 +62,13 @@ "blockstore-core": "^4.0.0", "interface-blockstore": "^5.0.0", "interface-store": "^5.0.0", - "level": "^8.0.0", - "multiformats": "^13.0.0" + "level": "^8.0.1", + "multiformats": "^13.0.1" }, "devDependencies": { - "aegir": "^41.1.9", + "aegir": "^42.2.3", "interface-blockstore-tests": "^6.0.0", - "ipfs-utils": "^9.0.4", + "ipfs-utils": "^9.0.14", "memory-level": "^1.0.0" } } diff --git a/packages/blockstore-s3/README.md b/packages/blockstore-s3/README.md index 874db8f0..fa1f519e 100644 --- a/packages/blockstore-s3/README.md +++ b/packages/blockstore-s3/README.md @@ -1,3 +1,5 @@ +# blockstore-s3 + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/blockstore-s3/package.json b/packages/blockstore-s3/package.json index 4d3dd557..b3e6f6b5 100644 --- a/packages/blockstore-s3/package.json +++ b/packages/blockstore-s3/package.json @@ -3,7 +3,7 @@ "version": "1.0.14", "description": "IPFS blockstore implementation backed by s3", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/blockstore-s3#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/blockstore-s3#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "blockstore", "interface", @@ -39,96 +43,10 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", "build": "aegir build", - "release": "aegir release", "test": "aegir test", "test:node": "aegir test -t node --cov", "test:chrome": "aegir test -t browser --cov", @@ -139,17 +57,17 @@ "dep-check": "aegir dep-check" }, "dependencies": { - "@aws-sdk/client-s3": "^3.297.0", + "@aws-sdk/client-s3": "^3.511.0", "blockstore-core": "^4.0.0", "interface-blockstore": "^5.0.0", "interface-store": "^5.0.0", - "it-to-buffer": "^4.0.1", - "multiformats": "^13.0.0", - "uint8arrays": "^5.0.0" + "it-to-buffer": "^4.0.5", + "multiformats": "^13.0.1", + "uint8arrays": "^5.0.2" }, "devDependencies": { - "@types/sinon": "^17.0.2", - "aegir": "^41.1.9", + "@types/sinon": "^17.0.3", + "aegir": "^42.2.3", "interface-blockstore-tests": "^6.0.0", "p-defer": "^4.0.0", "sinon": "^17.0.1" diff --git a/packages/datastore-core/README.md b/packages/datastore-core/README.md index 03229227..66a1aa0f 100644 --- a/packages/datastore-core/README.md +++ b/packages/datastore-core/README.md @@ -1,3 +1,5 @@ +# datastore-core + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) @@ -5,6 +7,67 @@ > Wrapper implementation for interface-datastore +# About + +Various Datastore implementations are available. + +## Implementations + +- Mount: [`src/mount`](src/mount.ts) +- Keytransform: [`src/keytransform`](src/keytransform.ts) +- Sharding: [`src/sharding`](src/sharding.ts) +- Tiered: [`src/tiered`](src/tirered.ts) +- Namespace: [`src/namespace`](src/namespace.ts) +- BlackHole: [`src/black-hole`](src/black-hole.ts) + +## Example - BaseDatastore + +An base store is made available to make implementing your own datastore easier: + +```javascript +import { BaseDatastore } from 'datastore-core' + +class MyDatastore extends BaseDatastore { + constructor () { + super() + } + + async put (key, val) { + // your implementation here + } + + async get (key) { + // your implementation here + } + + // etc... +} +``` + +See the [MemoryDatastore](./src/memory.js) for an example of how it is used. + +## Example - Wrapping Stores + +```js +import { Key } from 'interface-datastore' +import { + MemoryStore, + MountStore +} from 'datastore-core' + +const store = new MountStore({prefix: new Key('/a'), datastore: new MemoryStore()}) +``` + +## Example - BlackHoleDatastore + +A datastore that does not store any data. + +```js +import { BlackHoleDatastore } from 'datastore-core/black-hole' + +const store = new BlackHoleDatastore() +``` + # Install ```console diff --git a/packages/datastore-core/package.json b/packages/datastore-core/package.json index 742964d8..b4919a30 100644 --- a/packages/datastore-core/package.json +++ b/packages/datastore-core/package.json @@ -4,7 +4,7 @@ "description": "Wrapper implementation for interface-datastore", "author": "Friedel Ziegelmayer ", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/datastore-core#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/datastore-core#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -12,6 +12,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "datastore", "interface", @@ -95,96 +99,10 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", "build": "aegir build", - "release": "aegir release", "test": "aegir test", "test:node": "aegir test -t node --cov", "test:chrome": "aegir test -t browser --cov", @@ -195,23 +113,23 @@ "dep-check": "aegir dep-check" }, "dependencies": { - "@libp2p/logger": "^4.0.1", + "@libp2p/logger": "^4.0.6", "err-code": "^3.0.1", + "interface-datastore": "^8.0.0", "interface-store": "^5.0.0", - "it-all": "^3.0.1", - "it-drain": "^3.0.1", - "it-filter": "^3.0.0", - "it-map": "^3.0.1", - "it-merge": "^3.0.1", - "it-pipe": "^3.0.0", - "it-pushable": "^3.0.0", - "it-sort": "^3.0.1", - "it-take": "^3.0.1", - "uint8arrays": "^5.0.0" + "it-drain": "^3.0.5", + "it-filter": "^3.0.4", + "it-map": "^3.0.5", + "it-merge": "^3.0.3", + "it-pipe": "^3.0.1", + "it-pushable": "^3.2.3", + "it-sort": "^3.0.4", + "it-take": "^3.0.4" }, "devDependencies": { - "aegir": "^41.1.9", - "interface-datastore": "^8.0.0", - "interface-datastore-tests": "^5.0.0" + "aegir": "^42.2.3", + "interface-datastore-tests": "^5.0.0", + "it-all": "^3.0.4", + "uint8arrays": "^5.0.2" } } diff --git a/packages/datastore-fs/README.md b/packages/datastore-fs/README.md index 6ea50496..04454a72 100644 --- a/packages/datastore-fs/README.md +++ b/packages/datastore-fs/README.md @@ -1,3 +1,5 @@ +# datastore-fs + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/datastore-fs/package.json b/packages/datastore-fs/package.json index 13a36126..b94ed5db 100644 --- a/packages/datastore-fs/package.json +++ b/packages/datastore-fs/package.json @@ -4,7 +4,7 @@ "description": "Datastore implementation with file system backend", "author": "Friedel Ziegelmayer", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/datastore-fs#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/datastore-fs#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -12,6 +12,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "datastore", "fs", @@ -40,91 +44,6 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", @@ -137,17 +56,17 @@ }, "dependencies": { "datastore-core": "^9.0.0", - "fast-write-atomic": "^0.2.0", + "fast-write-atomic": "^0.2.1", "interface-datastore": "^8.0.0", "interface-store": "^5.0.0", - "it-glob": "^2.0.1", - "it-map": "^3.0.1", - "it-parallel-batch": "^3.0.0" + "it-glob": "^2.0.6", + "it-map": "^3.0.5", + "it-parallel-batch": "^3.0.4" }, "devDependencies": { "@types/mkdirp": "^2.0.0", - "aegir": "^41.1.9", + "aegir": "^42.2.3", "interface-datastore-tests": "^5.0.0", - "ipfs-utils": "^9.0.4" + "ipfs-utils": "^9.0.14" } } diff --git a/packages/datastore-idb/README.md b/packages/datastore-idb/README.md index 52bdec2b..68c97a86 100644 --- a/packages/datastore-idb/README.md +++ b/packages/datastore-idb/README.md @@ -1,3 +1,5 @@ +# datastore-idb + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/datastore-idb/package.json b/packages/datastore-idb/package.json index 6e00ac82..900b0ae7 100644 --- a/packages/datastore-idb/package.json +++ b/packages/datastore-idb/package.json @@ -4,7 +4,7 @@ "description": "Datastore implementation with IndexedDB backend.", "author": "Hugo Dias ", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/datastore-idb#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/datastore-idb#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -12,6 +12,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "browser", "datastore", @@ -44,91 +48,6 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "test": "aegir test -t browser -t webworker", "test:browser": "aegir test -t browser", @@ -139,14 +58,14 @@ "dep-check": "aegir dep-check" }, "dependencies": { + "datastore-core": "^9.0.0", "idb": "^8.0.0", "interface-datastore": "^8.0.0", - "it-filter": "^3.0.0", - "it-sort": "^3.0.1" + "it-filter": "^3.0.4", + "it-sort": "^3.0.4" }, "devDependencies": { - "aegir": "^41.1.9", - "datastore-core": "^9.0.0", + "aegir": "^42.2.3", "interface-datastore-tests": "^5.0.0" } } diff --git a/packages/datastore-level/README.md b/packages/datastore-level/README.md index c2a8674b..938cab76 100644 --- a/packages/datastore-level/README.md +++ b/packages/datastore-level/README.md @@ -1,3 +1,5 @@ +# datastore-level + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/datastore-level/package.json b/packages/datastore-level/package.json index fceed9bb..817e02af 100644 --- a/packages/datastore-level/package.json +++ b/packages/datastore-level/package.json @@ -4,7 +4,7 @@ "description": "Datastore implementation with level(up|down) backend", "author": "Friedel Ziegelmayer", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/datastore-level#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/datastore-level#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -12,6 +12,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "datastore", "interface", @@ -42,91 +46,6 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", @@ -144,16 +63,16 @@ "dependencies": { "datastore-core": "^9.0.0", "interface-datastore": "^8.0.0", - "it-filter": "^3.0.0", - "it-map": "^3.0.1", - "it-sort": "^3.0.1", - "it-take": "^3.0.1", - "level": "^8.0.0" + "it-filter": "^3.0.4", + "it-map": "^3.0.5", + "it-sort": "^3.0.4", + "it-take": "^3.0.4", + "level": "^8.0.1" }, "devDependencies": { - "aegir": "^41.1.9", + "aegir": "^42.2.3", "interface-datastore-tests": "^5.0.0", - "ipfs-utils": "^9.0.4", + "ipfs-utils": "^9.0.14", "memory-level": "^1.0.0" } } diff --git a/packages/datastore-s3/README.md b/packages/datastore-s3/README.md index 608d7801..2abdac48 100644 --- a/packages/datastore-s3/README.md +++ b/packages/datastore-s3/README.md @@ -1,3 +1,5 @@ +# datastore-s3 + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/datastore-s3/package.json b/packages/datastore-s3/package.json index 0c96d853..2fa5da4e 100644 --- a/packages/datastore-s3/package.json +++ b/packages/datastore-s3/package.json @@ -3,7 +3,7 @@ "version": "11.1.10", "description": "IPFS datastore implementation backed by s3", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/datastore-s3#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/datastore-s3#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "datastore", "interface", @@ -39,91 +43,6 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "clean": "aegir clean", "lint": "aegir lint", @@ -139,17 +58,17 @@ "dep-check": "aegir dep-check" }, "dependencies": { - "@aws-sdk/client-s3": "^3.297.0", + "@aws-sdk/client-s3": "^3.511.0", "datastore-core": "^9.0.0", "interface-datastore": "^8.0.0", "interface-store": "^5.0.0", - "it-filter": "^3.0.0", - "it-to-buffer": "^4.0.1", - "uint8arrays": "^5.0.0" + "it-filter": "^3.0.4", + "it-to-buffer": "^4.0.5", + "uint8arrays": "^5.0.2" }, "devDependencies": { - "@types/sinon": "^17.0.2", - "aegir": "^41.1.9", + "@types/sinon": "^17.0.3", + "aegir": "^42.2.3", "interface-datastore-tests": "^5.0.0", "p-defer": "^4.0.0", "sinon": "^17.0.1" diff --git a/packages/interface-blockstore-tests/README.md b/packages/interface-blockstore-tests/README.md index bd7f6239..a8bfbdb8 100644 --- a/packages/interface-blockstore-tests/README.md +++ b/packages/interface-blockstore-tests/README.md @@ -1,3 +1,5 @@ +# interface-blockstore-tests + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/interface-blockstore-tests/package.json b/packages/interface-blockstore-tests/package.json index 3ca977be..c3bbfe3a 100644 --- a/packages/interface-blockstore-tests/package.json +++ b/packages/interface-blockstore-tests/package.json @@ -3,7 +3,7 @@ "version": "6.1.9", "description": "Compliance tests for the blockstore interface", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/interface-blockstore-tests#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/interface-blockstore-tests#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "blockstore", "interface", @@ -38,91 +42,6 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "build": "aegir build", "lint": "aegir lint", @@ -132,12 +51,12 @@ }, "dependencies": { "interface-blockstore": "^5.0.0", - "it-all": "^3.0.1", - "it-drain": "^3.0.1", - "multiformats": "^13.0.0", - "uint8arrays": "^5.0.0" + "it-all": "^3.0.4", + "it-drain": "^3.0.5", + "multiformats": "^13.0.1", + "uint8arrays": "^5.0.2" }, "devDependencies": { - "aegir": "^41.1.9" + "aegir": "^42.2.3" } } diff --git a/packages/interface-blockstore/README.md b/packages/interface-blockstore/README.md index 0986e458..b8980909 100644 --- a/packages/interface-blockstore/README.md +++ b/packages/interface-blockstore/README.md @@ -1,3 +1,5 @@ +# interface-blockstore + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/interface-blockstore/package.json b/packages/interface-blockstore/package.json index 3e6495ba..0c87ba8d 100644 --- a/packages/interface-blockstore/package.json +++ b/packages/interface-blockstore/package.json @@ -3,7 +3,7 @@ "version": "5.2.9", "description": "An interface for storing and retrieving blocks", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/interface-blockstore#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/interface-blockstore#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "type": "module", "types": "./dist/src/index.d.ts", "files": [ @@ -32,91 +36,6 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "build": "aegir build", "lint": "aegir lint", @@ -125,9 +44,9 @@ }, "dependencies": { "interface-store": "^5.0.0", - "multiformats": "^13.0.0" + "multiformats": "^13.0.1" }, "devDependencies": { - "aegir": "^41.1.9" + "aegir": "^42.2.3" } } diff --git a/packages/interface-datastore-tests/README.md b/packages/interface-datastore-tests/README.md index 7befb1ef..649f63fb 100644 --- a/packages/interface-datastore-tests/README.md +++ b/packages/interface-datastore-tests/README.md @@ -1,3 +1,5 @@ +# interface-datastore-tests + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/interface-datastore-tests/package.json b/packages/interface-datastore-tests/package.json index eb48f370..d98a2b43 100644 --- a/packages/interface-datastore-tests/package.json +++ b/packages/interface-datastore-tests/package.json @@ -3,7 +3,7 @@ "version": "5.1.7", "description": "Compliance tests for the datastore interface", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/interface-datastore-tests#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/interface-datastore-tests#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "datastore", "interface", @@ -38,91 +42,6 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "build": "aegir build", "lint": "aegir lint", @@ -132,13 +51,13 @@ }, "dependencies": { "interface-datastore": "^8.0.0", - "iso-random-stream": "^2.0.0", - "it-all": "^3.0.1", - "it-drain": "^3.0.1", - "it-length": "^3.0.1", - "uint8arrays": "^5.0.0" + "iso-random-stream": "^2.0.2", + "it-all": "^3.0.4", + "it-drain": "^3.0.5", + "it-length": "^3.0.4", + "uint8arrays": "^5.0.2" }, "devDependencies": { - "aegir": "^41.1.9" + "aegir": "^42.2.3" } } diff --git a/packages/interface-datastore/README.md b/packages/interface-datastore/README.md index 69454128..48062c9c 100644 --- a/packages/interface-datastore/README.md +++ b/packages/interface-datastore/README.md @@ -1,3 +1,5 @@ +# interface-datastore + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) @@ -5,6 +7,102 @@ > datastore interface +# About + +A Datastore is a key/value database that lets store/retrieve binary blobs using namespaced Keys. + +It is used by IPFS to store/retrieve arbitrary metadata needed to run the node - DHT provider records, signed peer records, etc. + +## Backed Implementations + +- File System: [`datastore-fs`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-fs) +- IndexedDB: [`datastore-idb`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-idb) +- level: [`datastore-level`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-level) (supports any levelup compatible backend) +- Memory: [`datastore-core/memory`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/memory.ts) +- S3: [`datastore-s3`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-s3) + +## Wrapper Implementations + +- Keytransform: [`datstore-core/src/keytransform`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/keytransform.ts) +- Mount: [`datastore-core/src/mount`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/mount.ts) +- Namespace: [`datastore-core/src/namespace`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/namespace.ts) +- Sharding: [`datastore-core/src/sharding`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/sharding.ts) +- Tiered: [`datstore-core/src/tiered`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/tiered.ts) + +If you want the same functionality as [go-ds-flatfs](https://github.com/ipfs/go-ds-flatfs), use sharding with fs. + +## Example + +```js +import FsStore from 'datastore-fs' +import { ShardingDataStore, shard } from 'datastore-core' + +const fs = new FsStore('path/to/store') + +// flatfs now works like go-flatfs +const flatfs = await ShardingStore.createOrOpen(fs, new shard.NextToLast(2)) +``` + +### Test suite + +Available via the [`interface-datastore-tests`](https://npmjs.com/package/interface-datastore-tests) module + +```js +import { interfaceDatastoreTests } from 'interface-datastore-tests' + +describe('mystore', () => { + interfaceDatastoreTests({ + async setup () { + return instanceOfMyStore + }, + async teardown () { + // cleanup resources + } + }) +}) +``` + +### Aborting requests + +Most API methods accept an \[AbortSignal]\[] as part of an options object. Implementations may listen for an `abort` event emitted by this object, or test the `signal.aborted` property. When received implementations should tear down any long-lived requests or resources created. + +### Concurrency + +The streaming `(put|get|delete)Many` methods are intended to be used with modules such as [it-parallel-batch](https://www.npmjs.com/package/it-parallel-batch) to allow calling code to control levels of parallelisation. The batching method ensures results are returned in the correct order, but interface implementations should be thread safe. + +```js +import batch from 'it-parallel-batch' +const source = [{ + key: .., + value: .. +}] + +// put values into the datastore concurrently, max 10 at a time +for await (const { key, data } of batch(store.putMany(source), 10)) { + console.info(`Put ${key}`) +} +``` + +### Keys + +To allow a better abstraction on how to address values, there is a `Key` class which is used as identifier. It's easy to create a key from a `Uint8Array` or a `string`. + +```js +const a = new Key('a') +const b = new Key(new Uint8Array([0, 1, 2, 3])) +``` + +The key scheme is inspired by file systems and Google App Engine key model. Keys are meant to be unique across a system. They are typically hierarchical, incorporating more and more specific namespaces. Thus keys can be deemed 'children' or 'ancestors' of other keys: + +- `new Key('/Comedy')` +- `new Key('/Comedy/MontyPython')` + +Also, every namespace can be parameterized to embed relevant object information. For example, the Key `name` (most specific namespace) could include the object type: + +- `new Key('/Comedy/MontyPython/Actor:JohnCleese')` +- `new Key('/Comedy/MontyPython/Sketch:CheeseShop')` +- `new Key('/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender')` + # Install ```console diff --git a/packages/interface-datastore/package.json b/packages/interface-datastore/package.json index 4bfbd158..081b5e08 100644 --- a/packages/interface-datastore/package.json +++ b/packages/interface-datastore/package.json @@ -3,7 +3,7 @@ "version": "8.2.10", "description": "datastore interface", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/interface-datastore#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/interface-datastore#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "datastore", "interface", @@ -58,91 +62,6 @@ "sourceType": "module" } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "build": "aegir build", "lint": "aegir lint", @@ -158,9 +77,9 @@ }, "dependencies": { "interface-store": "^5.0.0", - "uint8arrays": "^5.0.0" + "uint8arrays": "^5.0.2" }, "devDependencies": { - "aegir": "^41.1.9" + "aegir": "^42.2.3" } } diff --git a/packages/interface-store/README.md b/packages/interface-store/README.md index 0a7edca7..2f152391 100644 --- a/packages/interface-store/README.md +++ b/packages/interface-store/README.md @@ -1,3 +1,5 @@ +# interface-store + [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores) diff --git a/packages/interface-store/package.json b/packages/interface-store/package.json index ed4e54d0..d2620a04 100644 --- a/packages/interface-store/package.json +++ b/packages/interface-store/package.json @@ -3,7 +3,7 @@ "version": "5.1.7", "description": "A generic interface for storing and retrieving data", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/js-stores/tree/master/packages/interface-store#readme", + "homepage": "https://github.com/ipfs/js-stores/tree/main/packages/interface-store#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/js-stores.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/js-stores/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "main": "src/index.js", "types": "dist/src/index.d.ts", "typesVersions": { @@ -37,91 +41,6 @@ "project": true } }, - "release": { - "branches": [ - "main" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "type": "deps", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Documentation" - }, - { - "type": "deps", - "section": "Dependencies" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - }, "scripts": { "build": "aegir build", "lint": "aegir lint", @@ -130,6 +49,6 @@ "dep-check": "aegir dep-check" }, "devDependencies": { - "aegir": "^41.1.9" + "aegir": "^42.2.3" } }