Class

BlockStore

BlockStore(store)

BlockStore is a simple key/value store for adding, deleting, and retrieving immutable blocks of data. It satisfies the default IPFS block store interface: https://github.com/ipfs/js-ipfs-repo.

Constructor

# new BlockStore(store)

BlockStore creates a new block store.
Parameters:
Name Type Description
store Datastore The underlying datastore for locally caching immutable blocks of data.

View Source core/blockstore.ts, line 32

Classes

BlockStore

Members

# static cidToKey

cidToKey transforms a CID to the appropriate block store key.

View Source core/blockstore.ts, line 130

# static keyToCid

keyToCid transforms a block store key to a CID.

View Source core/blockstore.ts, line 136

Methods

# static cidToKey(cid)

cidToKey transforms a CID to the appropriate block store key.
Parameters:
Name Type Description
cid CID The content identifier for an immutable block of data.

View Source core/blockstore.ts, line 105

# static keyToCid(key)

keyToCid transforms a block store key to a CID.
Parameters:
Name Type Description
key Key The key used to encode the CID.

View Source core/blockstore.ts, line 117

# async delete(cid)

delete removes a block from the store.
Parameters:
Name Type Description
cid CID The content identifier for an immutable block of data.

View Source core/blockstore.ts, line 77

# async get(cid)

get returns a block by cid.
Parameters:
Name Type Description
cid CID The content identifier for an immutable block of data.

View Source core/blockstore.ts, line 68

# async has(cid)

has returns whether the store contains the block associated with the given CID.
Parameters:
Name Type Description
cid CID The content identifier for an immutable block of data.

View Source core/blockstore.ts, line 85

# async put(block)

put adds a block to the block store.
Parameters:
Name Type Description
block Block An immutable block of data.

View Source core/blockstore.ts, line 40

# async putMany(blocks)

putMany adds multiple blocks to the store.
Parameters:
Name Type Description
blocks Iterable.<Block> An iterable of immutable blocks of data.

View Source core/blockstore.ts, line 52

# async generator query(query)

query searches the store for blocks matching the query parameters. It returns results from the underlying datastore (i.e., not Blocks).
Parameters:
Name Type Description
query Query A set of query options to use when querying the underlying datastore.

View Source core/blockstore.ts, line 94