Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

datastore-core

ipfs122.2kApache-2.0 OR MIT10.0.4TypeScript support: included

Wrapper implementation for interface-datastore

datastore, interface, ipfs, key-value

readme

datastore-core

ipfs.tech Discuss codecov CI

Wrapper implementation for interface-datastore

About

Various Datastore implementations are available.

Implementations

Example - BaseDatastore

An base store is made available to make implementing your own datastore easier:

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 for an example of how it is used.

Example - Wrapping Stores

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.

import { BlackHoleDatastore } from 'datastore-core/black-hole'

const store = new BlackHoleDatastore()

Install

$ npm i datastore-core

Browser <script> tag

Loading this module through a script tag will make its exports available as DatastoreCore in the global namespace.

<script src="https://unpkg.com/datastore-core/dist/index.min.js"></script>

API Docs

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.

Unless 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.

changelog

1.0.0 (2024-08-02)

⚠ BREAKING CHANGES

  • To detect the type of error thrown, use .name instead of .code
  • s3 filenames are now all base32upper
  • the output of store.getMany is now a stream of pairs
  • open/close/batch/query methods have been removed from store interface, query/batch added to datastore, getAll added to blockstore
  • bump multiformats from 10.0.3 to 11.0.0 (#182)
  • this module is now ESM only
  • deep requires/imports are no longer possible, moves adapters/in-memory impls etc to core packages
  • the compliance tests for interface-datastore have been removed - use the interface-datastore-tests module instead

Features

Bug Fixes

Trivial Changes

Documentation

Dependencies