Expand description
Database keys used by the client
Structs§
- Key used to lookup operation log entries in chronological order
- Does the client modules need to run recovery before being usable?
- Client metadata that will be stored/restored on backup&recovery
- An iterator over the variants of DbKeyPrefix
- Last valid backup the client attempted to make
Enums§
- Client initialization mode
- Like
InitMode
, but without no longer required data. - The state of the client initialization
Functions§
apply_migrations_client
iterates from the on disk database version for the client module up totarget_db_version
and executes all of the migrations that exist in the migrations map, including state machine migrations. Each migration in the migrations map updates the database to have the correct on-disk data structures that the code is expecting. The entire process is atomic, (i.e migration from 0->1 and 1->2 happen atomically). This function is called before the module is initialized and as long as the correct migrations are supplied in the migrations map, the module will be able to read and write from the database successfully.- Reads all active states from the database and returns
Vec<DynState>
. TODO: It is unfortunate that we can’t read states by the module’s instance id so we are forced to return all active states. Once we do a db migration to addmodule_instance_id
toActiveStateKey
, this can be improved to only read the module’s relevant states. - Reads all inactive states from the database and returns
Vec<DynState>
. TODO: It is unfortunate that we can’t read states by the module’s instance id so we are forced to return all inactive states. Once we do a db migration to addmodule_instance_id
toInactiveStateKey
, this can be improved to only read the module’s relevant states. - Migrates a particular state by looping over all active and inactive states. If the
migrate
closure returnsNone
, this state was not migrated and should be added to the new state machine vectors. - Persists new active states by first removing all current active states, and re-writing with the new set of active states.
new_active_states
is expected to contain all active states, not just the newly created states. - Persists new inactive states by first removing all current inactive states, and re-writing with the new set of inactive states.
new_inactive_states
is expected to contain all inactive states, not just the newly created states.
Type Aliases§
ClientMigrationFn
is a function that modules can implement to “migrate” the database to the next database version.- Helper function definition for migrating a single state.