An array of HandlerVersion
s that are to be used when processing blocks. The default
version name is "v1"
.
Information about the current state of the Action Handler
Process actions against deterministically accumulating Updater
functions. Returns a promise of versioned actions
for consumption by runEffects
, to make sure the correct effects are run on blocks that include a HandlerVersion
change. To change a HandlerVersion
, have an Updater
function return the versionName
of the corresponding
HandlerVersion
you want to change to.
Calls applyUpdaters
and runEffects
on the given actions
Receive block, validate, and handle actions with updaters and effects
Must call the passed-in handle
function within this method, passing in a state object that will be passed in to
the state
parameter to all calls of Updater.apply
. Optionally, pass in a context
object as a second
parameter, which can be utilized to share state across Updater.apply
and Effect.run
calls on a per-block basis.
Performs all required initialization for the handler.
Returns a promise for the lastProcessedBlockNumber
and lastProcessedBlockHash
meta state,
coinciding with the block that has just been processed.
These are the same values written by updateIndexState()
.
A promise that resolves to an IndexState
This method is used when matching the types of incoming actions against the types the Updater
s and Effect
s are
subscribed to. When this returns true, their corresponding functions will run.
By default, this method tests for direct equivalence between the incoming candidate type and the type that is subscribed. Override this method to extend this functionality (e.g. wildcards).
The incoming action's type
The type the Updater of Effect is subscribed to
Will run when a rollback block number is passed to handleActions. Implement this method to handle reversing actions full blocks at a time, until the last applied block is the block number passed to this method.
Process versioned actions against asynchronous side effects.
Idempotently performs any required setup.
Updates the lastProcessedBlockNumber
and lastProcessedBlockHash
meta state, coinciding with the block
that has just been processed. These are the same values read by updateIndexState()
.
Takes
block
s output from implementations ofAbstractActionReader
and processes their actions through theUpdater
s andEffect
s of the currentHandlerVersion
. Pass an object exposing a persistence API asstate
to thehandleWithState
method. Persist and retrieve information about the last block processed withupdateIndexState
andloadIndexState
. ImplementrollbackTo
to handle when a fork is encountered.