Struct exonum_configuration::ConfigurationSchema
[−]
[src]
pub struct ConfigurationSchema<T> { /* fields omitted */ }
ConfigurationService
database schema: tables and logically atomic mutation methods.
Methods
impl<T> ConfigurationSchema<T> where
T: AsRef<Snapshot>,
[src]
T: AsRef<Snapshot>,
fn new(snapshot: T) -> ConfigurationSchema<T>
fn propose_data_by_config_hash(
&self
) -> ProofMapIndex<&T, Hash, StorageValueConfigProposeData>
&self
) -> ProofMapIndex<&T, Hash, StorageValueConfigProposeData>
Returns a ProofMapIndex
table of all config proposes TxConfigPropose
, which are stored
within
StorageValueConfigProposeData
along with votes' data.
- Table key is hash of a configuration.
This hash is normalized when a new propose is put via
put_propose
:- bytes of a
String
, containing configuration json -> String
->- StoredConfiguration ->
- unique normalized
String
for a unique configuration -> - bytes ->
- hash(bytes)
- bytes of a
- Table value is
StorageValueConfigProposeData
, containingTxConfigPropose
, which contains bytes, corresponding to key.
fn config_hash_by_ordinal(&self) -> ProofListIndex<&T, Hash>
Returns a ProofListIndex
table of hashes of proposed configurations in propose
commit order.
- Table index is propose_id - position of a proposed hash of a configuration in the
corresponding
TxConfigPropose
commit order. - Table value is hash of a configuration - key of
propose_data_by_config_hash
fn votes_by_config_hash(
&self,
config_hash: &Hash
) -> ProofListIndex<&T, TxConfigVote>
&self,
config_hash: &Hash
) -> ProofListIndex<&T, TxConfigVote>
Returns a ProofListIndex
table of votes of validators for config, referenced by the
queried
config_hash
- hash of a configuration.
- The list of validators, who can vote for a config, is determined by
validators
of previous StoredConfiguration. Config, previous to a
StoredConfiguration
is referenced byprevious_cfg_hash
inStoredConfiguration
.
- Table index is validator_id - position of a validator's
PublicKey
in validator list of config, previous to config, referenced by the queriedconfig_hash
. - Table value is
TxConfigVote
, cast by validator with PublicKey, corresponding to index.
fn get_propose(&self, cfg_hash: &Hash) -> Option<TxConfigPropose>
fn get_votes(&self, cfg_hash: &Hash) -> Vec<Option<TxConfigVote>>
fn state_hash(&self) -> Vec<Hash>
impl<'a> ConfigurationSchema<&'a mut Fork>
[src]
fn propose_data_by_config_hash_mut(
&mut self
) -> ProofMapIndex<&mut Fork, Hash, StorageValueConfigProposeData>
&mut self
) -> ProofMapIndex<&mut Fork, Hash, StorageValueConfigProposeData>
Mutable version of propose_data_by_config_hash
index.
fn config_hash_by_ordinal_mut(&mut self) -> ProofListIndex<&mut Fork, Hash>
Mutable version of config_hash_by_ordinal
index.
fn votes_by_config_hash_mut(
&mut self,
config_hash: &Hash
) -> ProofListIndex<&mut Fork, TxConfigVote>
&mut self,
config_hash: &Hash
) -> ProofListIndex<&mut Fork, TxConfigVote>
Mutable version of votes_by_config_hash
index.
fn put_propose(&mut self, tx_propose: TxConfigPropose) -> bool
Put a new StorageValueConfigProposeData
into propose_data_by_config_hash
table with
following fields:
- tx_propose -
tx_propose
argument - num_votes -
validators.len()
of StoredConfiguration, referenced byprevious_cfg_hash
of config, stored intx_propose
. - votes_history_hash - root_hash of corresponding
votes_by_config_hash
table in a state right after initialization (all indices contain empty vote).
If an entry with the same hash of a configuration is present
in propose_data_by_config_hash
, as in config inside of tx_propose
, nothing is done.