Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
/ js-datastore-core Public archive

Contains various implementations of the API contract described in interface-datastore

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

ipfs/js-datastore-core

Repository files navigation

⛔️ This module is now part of https://github.com/ipfs/js-stores

datastore-core

ipfs.tech Discuss codecov CI

Wrapper implementation for interface-datastore

Table of contents

Install

$ npm i datastore-core

Browser <script> tag

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

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

Implementations

Usage

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.

Wrapping Stores

import { Key } from 'interface-datastore'
import {
  MemoryStore,
  MountStore
} from 'datastore-core'

const store = new MountStore({prefix: new Key('/a'), datastore: new MemoryStore()})

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

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.

About

Contains various implementations of the API contract described in interface-datastore

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published