BlockstoreStore
@twine-protocol/twine-blockstore-store v0.0.3 • Docs
twine-js / @twine-protocol/twine-blockstore-store / BlockstoreStore
Class: BlockstoreStore
Storage wrapper for storing Twine objects inside datastore and a blockstore
Implements
Store
Constructors
new BlockstoreStore()
new BlockstoreStore(
datastore
,blockstore
):BlockstoreStore
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
Methods
_cidOf()
_cidOf(
chain
,index
):Promise
<null
|CID
<unknown
,number
,number
,Version
>>
Get cid of pulse with specified index
Parameters
chain
IntoCid
The chain CID
index
number
The index
Returns
Promise
<null
| CID
<unknown
, number
, number
, Version
>>
The CID of the pulse, or null if not found
Defined in
reIndex()
reIndex(
latestCid
):Promise
<void
>
Reindex a chain
Parameters
latestCid
IntoCid
The CID of the latest pulse
Returns
Promise
<void
>
Defined in
fetchIndex()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
resolveLatest(
chain
):Promise
<PulseResolution
>
Resolves the latest pulse for specified chain
Parameters
chain
IntoCid
Returns
Promise
<PulseResolution
>
Implementation of
Store.resolveLatest
Defined in
Last updated