Expand description
Database keys used by the client
Structs§
- ApiSecret
Key - ApiSecret
KeyPrefix - Cached
ApiVersion Set - Cached
ApiVersion SetKey - Chronological
Operation LogKey - Key used to lookup operation log entries in chronological order
- Chronological
Operation LogKey Prefix - Client
Config Key - Client
Config KeyPrefix V0 - Client
Config KeyV0 - Client
Init State Key - Does the client modules need to run recovery before being usable?
- Client
Init State Prefix - Client
Metadata Key - Client metadata that will be stored/restored on backup&recovery
- Client
Metadata Prefix - Client
Module Recovery - Client
Module Recovery Prefix - Client
Module Recovery State - Client
PreRoot Secret Hash Key - Client
Recovery Snapshot - Client
Recovery Snapshot Prefix - DbKey
Prefix Iter - An iterator over the variants of DbKeyPrefix
- Encoded
Client Secret Key - Encoded
Client Secret KeyPrefix - Last
Backup Key - Last valid backup the client attempted to make
- Meta
Field Key - Meta
Field Prefix - Meta
Field Value - Meta
Service Info - Meta
Service Info Key - Operation
LogEntry V0 - V0 version of operation log entry for migration purposes
- Operation
LogKey - Operation
LogKey Prefix - Operation
LogKey Prefix V0 - Operation
LogKey V0 - Peer
Last ApiVersions Summary - Peer
Last ApiVersions Summary Key
Enums§
- DbKey
Prefix - Init
Mode - Client initialization mode
- Init
Mode Complete - Like
InitMode
, but without no longer required data. - Init
State - The state of the client initialization
Functions§
- apply_
migrations_ client_ module 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.- apply_
migrations_ client_ module_ dbtx - apply_
migrations_ core_ client_ dbtx - get_
active_ states - 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. - get_
core_ client_ database_ migrations - get_
decoded_ client_ secret - Fetches the encoded client secret from the database and decodes it. If an encoded client secret is not present in the database, or if decoding fails, an error is returned.
- get_
inactive_ 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. - remove_
old_ and_ persist_ new_ active_ states - 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. - remove_
old_ and_ persist_ new_ inactive_ 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. - verify_
client_ 🔒db_ integrity_ dbtx