{"name":"interface-datastore","version":"6.0.3","description":"datastore interface","leadMaintainer":"Alex Potsides <alex.potsides@protocol.ai>","types":"types/src/index.d.ts","typesVersions":{"*":{"*":["types/src/*"],"types/*":["types/src/*"],"types/src/*":["types/src/*"]}},"exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"},"./key":{"browser":"./esm/src/key.js","require":"./cjs/src/key.js","import":"./esm/src/key.js"}},"scripts":{"build":"aegir build","lint":"aegir ts -p check && aegir lint","coverage":"aegir test --cov","dep-check":"aegir dep-check -i rimraf","clean":"rimraf dist types","test":"aegir test"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-interfaces.git"},"keywords":["interface","key-value","ipfs","datastore"],"license":"MIT","bugs":{"url":"https://github.com/ipfs/js-ipfs-interfaces/issues"},"homepage":"https://github.com/ipfs/js-ipfs-interfaces/tree/master/packages/interface-datastore#readme","devDependencies":{"aegir":"^35.0.0","rimraf":"^3.0.2","util":"^0.12.4"},"dependencies":{"interface-store":"^2.0.1","nanoid":"^3.0.2","uint8arrays":"^3.0.0"},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"contributors":[{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Juan Batiz-Benet","email":"juan@benet.ai"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Hector Sanjuan","email":"code@hector.link"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"},{"name":"Alan Shaw","email":"alan.shaw@protocol.ai"},{"name":"Carson Farmer","email":"carson.farmer@gmail.com"},{"name":"Erin Dachtler","email":"download333@gmail.com"},{"name":"tcme","email":"hi@this-connect.me"},{"name":"Adam Uhlir","email":"adam@uhlir.dev"}],"publishConfig":{"directory":"dist"},"main":"./cjs/index.js","browser":{".":"./cjs/src/index.js","./key":"./cjs/src/key.js"},"_id":"interface-datastore@6.0.3","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (darwin)","dist":{"integrity":"sha512-61eOyzh7zH1ks/56hPudW6pbqsOdoHSYMVjuqlIlZGjyg0svR6DHlCcaeSJfWW8t6dsPl1n7qKBdk8ZqPzXuLA==","shasum":"f42163e4bfaea9e2fcde82e45d4bf2849e1fbbf5","tarball":"http://registry-npm.ywwl.com/interface-datastore/download/interface-datastore-6.0.3.tgz","fileCount":16,"unpackedSize":45224,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2v35CRA9TVsSAnZWagAALd4P/0oF0238t18Xesjk/6Ax\nG3NiZyE32y+Ty6iYnJW9AWP5oc3WSmPpcv5oyukUs5ItQ5v3Kv8eaudbvaGF\n/2272GWNV0hYvTy39DTmyOK/jxwQtREPCv1l/n3FV8uDaVqLlOUZpU4CJXnz\nECn0PfG4ODLDAKA+Mw/HKnh32MFKiYqzkslFmvMwoTXGXGsNwK4UP9sdVTVT\nHsOLEaLohWT9+g8a3+T3F71fdS2JE589sF6EfwyB7CvqOBwgKXy2reoNhwlY\nCNErYZYCxcjmCaLcgW4o2sPhZ9KqW6wU1IWlNWjPRk8kHgE/SJGokbUyQ/6f\n/i8hk9944BudIlEKjC1D1xkPk2CfM3tMJ+kIhtb2JB6hDhJy8uMNobjrs3rL\nu0UI6+/dnmoqygzOdKioPoUrWfEHmkMIOw4LM1g0keV3AeVxwEd2ophblbmP\nU6xZ9Xr/iH17uRSMoyih6Mrhglw4i8fLQjWCTomfBMdacE8b84O8RcSZlspa\nVE1rr19/TK1RpcQApx+aQ4ocAKzKVR3jU8NuWjQtH/gZMycmjmNfeKu0OQTZ\n/Lf9daylYbC56/CI750AN0+2FeCzEwgG3vT7oVBq/D5pNwFYEirv2Kzh2eiF\nBbe5fgd42VzvcvYRfJR2iRQ8Bzyl/iXMPeq0sEegNirOMhF8+rljnq4fjgWW\n0czk\r\n=RNdz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDwkEH9jSA5vnvn+2L7Qvd75IpltatkRTBZ2djwd+KcNQIhAK/B3pmZtA2ZxSmBlq+l3VO3Ql1ivtGoasGvWsfJbS03"}],"size":13926,"noattachment":false,"key":"/interface-datastore/-/interface-datastore-6.0.3.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_6.0.3_1631890952352_0.2828605377482487"},"_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":1631890952524,"_cnpm_publish_time":1631890952524,"dist-tags":{"latest":"10.0.1"}}