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. |
Classes
Members
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. |
# 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. |
# 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. |
# async get(cid)
get returns a block by cid.
Parameters:
Name | Type | Description |
---|---|---|
cid |
CID | The content identifier for an immutable block of data. |
# 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. |
# async put(block)
put adds a block to the block store.
Parameters:
Name | Type | Description |
---|---|---|
block |
Block | An immutable block of data. |
# async putMany(blocks)
putMany adds multiple blocks to the store.
Parameters:
Name | Type | Description |
---|---|---|
blocks |
Iterable.<Block> | An iterable of immutable blocks of data. |
# 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. |