{"name":"interface-datastore","version":"7.0.4","description":"datastore interface","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs-interfaces/tree/master/packages/interface-datastore#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-interfaces.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs-interfaces/issues"},"keywords":["datastore","interface","ipfs","key-value"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js"},"./key":{"types":"./dist/src/key.d.ts","import":"./dist/src/key.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"release":{"branches":["master"],"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","dep-check":"aegir dep-check","clean":"aegir clean","test":"aegir test","test:node":"aegir test -t node --cov","test:chrome":"aegir test -t browser --cov","test:chrome-webworker":"aegir test -t webworker","test:firefox":"aegir test -t browser -- --browser firefox","test:firefox-webworker":"aegir test -t webworker -- --browser firefox","release":"aegir release"},"dependencies":{"interface-store":"^3.0.0","nanoid":"^4.0.0","uint8arrays":"^4.0.2"},"devDependencies":{"aegir":"^38.1.0"},"typedoc":{"entryPoint":"./src/index.ts"},"gitHead":"3430b6cf00f8512b67dc9034fa22f6355c92197a","_id":"interface-datastore@7.0.4","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-Q8LZS/jfFFHz6XyZazLTAc078SSCoa27ZPBOfobWdpDiFO7FqPA2yskitUJIhaCgxNK8C+/lMBUTBNfVIDvLiw==","shasum":"f09ae4e2896f57f876d5d742a59e982fb3f42891","tarball":"http://registry-npm.ywwl.com/interface-datastore/download/interface-datastore-7.0.4.tgz","fileCount":15,"unpackedSize":69881,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE7uGCilyPbV494ic5pOmlZ1Jt7oQaHw4rJaEQ82qqi/AiEA4dTtBf5XeknevNgtbfG5fvIHTwsj/evywRAJFUl9HJk="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2AQtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmroNw//fPsENQ65ftnFr1ZtwwnSwiS0TEIDrJib9ZGx4MKaAICYxr+C\r\nVx8ui4sH3Sws9Opj5qsS8IZQMRT05mf8P1eb49/nxZQv0VjBZtuaBWQ9iOw1\r\n3r92pNf9VSZEKz6yxDXbqmBR2MDHfAxY9UzpTg+MTUBO0Z++Zq+Se92fYYX1\r\nKhVCsa89J4BALsj7upHx8RnVXscG9DzWgC7AGmW6H8uc2EFsGVpw29Gwid2j\r\nIPK9epvV9Uy4KLHdSoqooag8eDhh6eBdYZ20AJmMNz3gPIl+Kqy7EPLk+BBR\r\nC9v/n7M/yUV2qvt3XTKmtNBuCcxvQU6Pc12YFhOrx5aG4L6Nv+acI+27J4oz\r\nS2ViK0O4fWjrHQ4kezU2dU+DWdaum3tr2zCPn1GMpwv5reM90GMc9JzA5QsX\r\nuVlqmHjq0yT8Pfi1RruPyUUhGxbqiAYkuDqX8MevrB9eXngvXM0wytjbfbn4\r\nlBy86qGnGD9frfaXeFsKBflYpb1fSYbKKs5qxeoSoOaFwoVIu7oLuWPpHPQt\r\nOmtMcM5JqNxQPVF7HivFc0QlrckAiuYfaOzJPJb/YkWQiCc1Ov9SmtDCuRb2\r\nPDqiIrFaup38DQO56Lr+3BVn9GUQnYhQtIJD+oRjEMS5DnbbnTrdTNnan3Qy\r\nWOThSuj0TCNREW9w7bOhDGfjUL563zbaT0s=\r\n=j54M\r\n-----END PGP SIGNATURE-----\r\n","size":18684,"noattachment":false,"key":"/interface-datastore/-/interface-datastore-7.0.4.tgz"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"daviddias","email":"mail@daviddias.me"},{"name":"dignifiedquire","email":"dignifiedquire@gmail.com"},{"name":"achingbrain","email":"alex@achingbrain.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/interface-datastore_7.0.4_1675101229685_0.6965162890917145"},"_hasShrinkwrap":false,"readme":"# interface-datastore\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-stores.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-stores)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-stores/js-test-and-release.yml?branch=main\\&style=flat-square)](https://github.com/ipfs/js-stores/actions/workflows/js-test-and-release.yml?query=branch%3Amain)\n\n> datastore interface\n\n# About\n\nA Datastore is a key/value database that lets store/retrieve binary blobs using namespaced Keys.\n\nIt is used by IPFS to store/retrieve arbitrary metadata needed to run the node - DHT provider records, signed peer records, etc.\n\n## Backed Implementations\n\n- File System: [`datastore-fs`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-fs)\n- IndexedDB: [`datastore-idb`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-idb)\n- level: [`datastore-level`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-level) (supports any levelup compatible backend)\n- Memory: [`datastore-core/memory`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/memory.ts)\n- S3: [`datastore-s3`](https://github.com/ipfs/js-stores/tree/main/packages/datastore-s3)\n\n## Wrapper Implementations\n\n- Keytransform: [`datstore-core/src/keytransform`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/keytransform.ts)\n- Mount: [`datastore-core/src/mount`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/mount.ts)\n- Namespace: [`datastore-core/src/namespace`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/namespace.ts)\n- Sharding: [`datastore-core/src/sharding`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/sharding.ts)\n- Tiered: [`datstore-core/src/tiered`](https://github.com/ipfs/js-stores/blob/main/packages/datastore-core/src/tiered.ts)\n\nIf you want the same functionality as [go-ds-flatfs](https://github.com/ipfs/go-ds-flatfs), use sharding with fs.\n\n## Example\n\n```js\nimport FsStore from 'datastore-fs'\nimport { ShardingDataStore, shard } from 'datastore-core'\n\nconst fs = new FsStore('path/to/store')\n\n// flatfs now works like go-flatfs\nconst flatfs = await ShardingStore.createOrOpen(fs, new shard.NextToLast(2))\n```\n\n### Test suite\n\nAvailable via the [`interface-datastore-tests`](https://npmjs.com/package/interface-datastore-tests) module\n\n```js\nimport { interfaceDatastoreTests } from 'interface-datastore-tests'\n\ndescribe('mystore', () => {\n  interfaceDatastoreTests({\n    async setup () {\n      return instanceOfMyStore\n    },\n    async teardown () {\n      // cleanup resources\n    }\n  })\n})\n```\n\n### Aborting requests\n\nMost 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.\n\n### Concurrency\n\nThe 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.\n\n```js\nimport batch from 'it-parallel-batch'\nconst source = [{\n  key: ..,\n  value: ..\n}]\n\n// put values into the datastore concurrently, max 10 at a time\nfor await (const { key, data } of batch(store.putMany(source), 10)) {\n  console.info(`Put ${key}`)\n}\n```\n\n### Keys\n\nTo 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`.\n\n```js\nconst a = new Key('a')\nconst b = new Key(new Uint8Array([0, 1, 2, 3]))\n```\n\nThe 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:\n\n- `new Key('/Comedy')`\n- `new Key('/Comedy/MontyPython')`\n\nAlso, every namespace can be parameterized to embed relevant object information. For example, the Key `name` (most specific namespace) could include the object type:\n\n- `new Key('/Comedy/MontyPython/Actor:JohnCleese')`\n- `new Key('/Comedy/MontyPython/Sketch:CheeseShop')`\n- `new Key('/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender')`\n\n# Install\n\n```console\n$ npm i interface-datastore\n```\n\n## Browser `<script>` tag\n\nLoading this module through a script tag will make it's exports available as `InterfaceDatastore` in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/interface-datastore/dist/index.min.js\"></script>\n```\n\n# API Docs\n\n- <https://ipfs.github.io/js-stores/modules/interface_datastore.html>\n\n# License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n# Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-stores/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n","publish_time":1675101229901,"_cnpm_publish_time":1675101229901,"dist-tags":{"latest":"10.0.1"}}