Skip to main content

LocalLeaseProvider

@totemsdk/wots-lease


@totemsdk/wots-lease / LocalLeaseProvider

Class: LocalLeaseProvider

Implements​

Constructors​

Constructor​

new LocalLeaseProvider(storage, logger?, deviceId?): LocalLeaseProvider

Parameters​

storage​

StorageAdapter

logger?​

LoggerAdapter = ...

deviceId?​

string = 'local'

Returns​

LocalLeaseProvider

Methods​

advanceToRemoteWatermark()​

advanceToRemoteWatermark(treeId, remote): Promise<boolean>

Advance the local watermark to a remote cursor (monotonic merge). Used by quorum sync and the lookup-node LeaseCoordinator when a peer publishes a watermark ahead of ours. Returns false when the remote cursor is behind (no-op).

Parameters​

treeId​

string

remote​
addressCursor​

number

l1Cursor​

number

l2Cursor​

number

Returns​

Promise<boolean>


burnReservation()​

burnReservation(reservationId, reason): Promise<void>

Parameters​

reservationId​

string

reason​

string

Returns​

Promise<void>

Implementation of​

WotsLeaseProvider.burnReservation


commitKeyUse()​

commitKeyUse(reservationId, txId): Promise<void>

Parameters​

reservationId​

string

txId​

string

Returns​

Promise<void>

Implementation of​

WotsLeaseProvider.commitKeyUse


getJournal()​

getJournal(): LeaseJournal

Expose the journal for quorum/on-chain providers to merge remote entries.

Returns​

LeaseJournal


getLocalWatermark()​

getLocalWatermark(treeId): Promise<LocalWatermark>

Parameters​

treeId​

string

Returns​

Promise<LocalWatermark>

Implementation of​

WotsLeaseProvider.getLocalWatermark


initialize()​

initialize(): Promise<void>

Returns​

Promise<void>


listTrees()​

listTrees(): string[]

List all tree IDs known to the local watermark store.

Returns​

string[]


publishWatermark()​

publishWatermark(_treeId): Promise<void>

Parameters​

_treeId​

string

Returns​

Promise<void>

Implementation of​

WotsLeaseProvider.publishWatermark


reserveKeyUse()​

reserveKeyUse(params): Promise<LeaseReservation>

Parameters​

params​

ReserveParams

Returns​

Promise<LeaseReservation>

Implementation of​

WotsLeaseProvider.reserveKeyUse


reserveSpecificKeyUse()​

reserveSpecificKeyUse(params, indices): Promise<LeaseReservation>

Reserve a specific set of indices (used by quorum coordination so every peer attests to the same slot). Throws IndicesUnavailableError when the slot is already taken.

Parameters​

params​

ReserveParams

indices​

SigningIndices

Returns​

Promise<LeaseReservation>


syncLeaseJournal()​

syncLeaseJournal(): Promise<SyncResult>

Returns​

Promise<SyncResult>

Implementation of​

WotsLeaseProvider.syncLeaseJournal


verifyLeaseCertificate()​

verifyLeaseCertificate(cert?): Promise<boolean>

Parameters​

cert?​

LeaseCertificate

Returns​

Promise<boolean>

Implementation of​

WotsLeaseProvider.verifyLeaseCertificate