BlockstoreStore
Last updated
Last updated
• Docs
/ / BlockstoreStore
Storage wrapper for storing Twine objects inside datastore and a blockstore
Store
new BlockstoreStore(
datastore
,blockstore
):
Create a new BlockstoreStore
Parameters
datastore
Datastore
<object
, object
, object
, object
, object
, object
, object
, object
, object
, object
>
The datastore to use
blockstore
Blockstore
<object
, object
, object
, object
, object
, object
, object
, object
>
The blockstore to use
Returns
Defined in
Get cid of pulse with specified index
Parameters
chain
IntoCid
The chain CID
index
number
The index
Returns
The CID of the pulse, or null if not found
Defined in
reIndex(
latestCid
):Promise
<void
>
Reindex a chain
Parameters
latestCid
IntoCid
The CID of the latest pulse
Returns
Promise
<void
>
Defined in
fetchIndex(
chain
,index
):Promise
<null
|Chain
|Pulse
>
fetch by index
Parameters
chain
IntoCid
The chain CID
index
number
The index
Returns
Promise
<null
| Chain
| Pulse
>
Defined in
save(
twine
):Promise
<void
>
Save a twine to storage
Parameters
twine
Twine
<TwineValue
>
The twine to save
Returns
Promise
<void
>
Implementation of
Store.save
Defined in
saveMany(
twines
):Promise
<void
>
Save many twines to storage
Parameters
twines
AnyIterable
<Twine
<TwineValue
>>
The twines to save
Returns
Promise
<void
>
Implementation of
Store.saveMany
Defined in
delete(
cid
):Promise
<void
>
Delete a twine from storage
Parameters
cid
IntoCid
The CID of the twine to delete
Returns
Promise
<void
>
Implementation of
Store.delete
Defined in
fetch(
cid
):Promise
<null
|Chain
|Pulse
>
Fetch a twine by it's CID
Parameters
cid
IntoCid
Returns
Promise
<null
| Chain
| Pulse
>
Implementation of
Store.fetch
Defined in
chains():
AsyncIterable
<Chain
,any
,any
>
Get the chains that are known to the resolver
Returns
AsyncIterable
<Chain
, any
, any
>
An sync/async iterable of chains
Example
Implementation of
Store.chains
Defined in
pulses(
chain
,start
?,options
?):AsyncIterable
<Pulse
,any
,any
>
Get the pulses of a chain
Parameters
chain
IntoCid
The chain CID or chain itself to get the pulses from
start
?
number
| IntoCid
The index or CID of the pulse to start from
options
?
ResolveOptions
Options for the resolution
Returns
AsyncIterable
<Pulse
, any
, any
>
An sync/async iterable of pulses
Example
Implementation of
Store.pulses
Defined in
has(
cid
):Promise
<boolean
>
Check if a Twine is present in the blockstore
Parameters
cid
IntoCid
Returns
Promise
<boolean
>
Implementation of
Store.has
Defined in
resolveIndex(
chain
,index
,options
?):Promise
<PulseResolution
>
Resolve a pulse by index
Parameters
chain
IntoCid
The chain CID or chain itself to resolve the pulse from
index
number
The index of the pulse to resolve
options
?
ResolveOptions
Options for the resolution
Returns
Promise
<PulseResolution
>
A pulse resolution
Example
Implementation of
Store.resolveIndex
Defined in
resolve(query, options)
resolve(
query
,options
?):Promise
<PulseResolution
>
Resolves a twine query
Parameters
query
IntoResolvePulseQuery
options
?
ResolveOptions
Returns
Promise
<PulseResolution
>
Implementation of
Store.resolve
Defined in
resolve(query, options)
resolve(
query
,options
?):Promise
<ChainResolution
>
Resolve a pulse (with its chain) from a query
Parameters
query
IntoResolveChainQuery
options
?
ResolveOptions
Returns
Promise
<ChainResolution
>
Implementation of
Store.resolve
Defined in
resolveLatest(
chain
):Promise
<PulseResolution
>
Resolves the latest pulse for specified chain
Parameters
chain
IntoCid
Returns
Promise
<PulseResolution
>
Implementation of
Store.resolveLatest
Defined in
_cidOf(chain
, index
): Promise
<null
| <unknown
, number
, number
, Version
>>
Promise
<null
| <unknown
, number
, number
, Version
>>