blockstore-core
Contains various implementations of the API contract described in interface-blockstore
Last updated 15 hours ago by GitHub Actions .
Apache-2.0 OR MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install blockstore-core 
SYNC missed versions from official npm registry.

blockstore-core

ipfs.tech Discuss codecov CI

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

About

Various Blockstore implementations are available.

BaseBlockstore

Provides a complete implementation of the Blockstore interface. You must implement .get, .put, etc.

Example

import { BaseBlockstore } from 'blockstore-core'

class MyCustomBlockstore extends BaseBlockstore {
  put (key, val, options) {
    // store a block
  }

  get (key, options) {
    // retrieve a block
  }

  // ...etc
}

MemoryBlockstore

A simple Blockstore that stores blocks in memory.

Example

import { MemoryBlockstore } from 'blockstore-core'

const store = new MemoryBlockstore()

BlackHoleBlockstore

A Blockstore that does not store any blocks.

Example

import { BlackHoleBlockstore } from 'blockstore-core'

const store = new BlackHoleBlockstore()

TieredBlockstore

A tiered blockstore wraps one or more blockstores and will query each in parallel to retrieve a block - the operation will succeed if any wrapped store has the block.

Writes are invoked on all wrapped blockstores.

Example

import { TieredBlockstore } from 'blockstore-core'

const store = new TieredBlockstore([
  store1,
  store2,
  // ...etc
])

IdentityBlockstore

An identity blockstore is one that deals exclusively in Identity CIDs - this is a special CID with the codec 0x00 where the multihash digest is the data that makes up the block.

Example

import { IdentityBlockstore } from 'blockstore-core'
import { CID } from 'multiformats/cid'

const blockstore = new IdentityBlockstore()

blockstore.has(CID.parse('QmFoo')) // false

blockstore.has(CID.parse('bafkqac3imvwgy3zao5xxe3de')) // true

Install

$ npm i blockstore-core

Browser <script> tag

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

<script src="https://unpkg.com/blockstore-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.

Current Tags

  • 6.1.3                                ...           latest (15 hours ago)

44 Versions

  • 6.1.3                                ...           15 hours ago
  • 6.1.2                                ...           3 months ago
  • 6.1.1                                ...           6 months ago
  • 6.1.0                                ...           6 months ago
  • 6.0.2                                ...           6 months ago
  • 6.0.1                                ...           6 months ago
  • 6.0.0                                ...           6 months ago
  • 5.0.4                                ...           10 months ago
  • 5.0.3                                ...           a year ago
  • 5.0.2                                ...           2 years ago
  • 5.0.1                                ...           2 years ago
  • 5.0.0                                ...           2 years ago
  • 4.4.1                                ...           2 years ago
  • 4.4.0                                ...           2 years ago
  • 4.3.11                                ...           2 years ago
  • 4.3.10                                ...           2 years ago
  • 4.3.9                                ...           2 years ago
  • 4.3.8                                ...           2 years ago
  • 4.3.7                                ...           2 years ago
  • 4.3.6                                ...           2 years ago
  • 4.3.5                                ...           2 years ago
  • 4.3.4                                ...           3 years ago
  • 4.3.3                                ...           3 years ago
  • 4.3.2                                ...           3 years ago
  • 4.3.1                                ...           3 years ago
  • 4.3.0                                ...           3 years ago
  • 4.2.0                                ...           3 years ago
  • 4.1.1                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.2                                ...           3 years ago
  • 4.0.1                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.5                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (5)

Copyright 2013 - present © cnpmjs.org | Home |