Skip to content

ChainSafe/js-datastore-core

 
 

Repository files navigation

datastore-core

ipfs.io IRC Discord codecov CI

Wrapper implementation for interface-datastore

Table of contents

Install

$ npm i datastore-core

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

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

This repository falls under the IPFS Code of Conduct.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.3%
  • TypeScript 0.7%