pub trait HoprDbInfoOperations {
Show 17 methods
// Required methods
fn index_is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clear_index_db<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn get_safe_hopr_balance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn set_safe_hopr_balance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
new_balance: Balance,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn get_safe_hopr_allowance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn set_safe_hopr_allowance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
new_allowance: Balance,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn get_safe_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<Option<SafeInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn set_safe_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
safe_info: SafeInfo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn get_indexer_data<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<IndexerData>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn set_domain_separator<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
dst_type: DomainSeparator,
value: Hash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn set_minimum_incoming_ticket_win_prob<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
win_prob: f64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn update_ticket_price<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
price: Balance,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn get_indexer_state_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<IndexerStateInfo>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn set_indexer_state_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
block_num: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn set_network_registry_enabled<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
enabled: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait;
fn get_global_setting<'a, 'life0, 'async_trait>(
&'a self,
tx: OptTx<'a>,
key: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<[u8]>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait;
fn set_global_setting<'a, 'life0, 'life1, 'async_trait>(
&'a self,
tx: OptTx<'a>,
key: &'life0 str,
value: Option<&'life1 [u8]>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Defines DB access API for various node information.
§Checksum computation
$H$ denotes Keccak256 hash function and $||$ byte string concatenation.
For a block $b_1$ containing logs $L_1, L_2, \ldots L_n$ corresponding to tx hashes $Tx_1, Tx_2, \ldots Tx_n$, a block hash is computed as:
H_{b_1} = H(Tx_1 || Tx_2 || \ldots || Tx_n)
Given $C_0 = H(0x00…0)$ , the checksum $C_{k+1}$ after processing block $b_{k+1}$ is given as follows:
C_{k+1} = H(C_k || H_{b_{k+1}})
Required Methods§
Sourcefn index_is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn index_is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Checks if the index is empty.
§Returns
A Result
containing a boolean indicating whether the index is empty.
Sourcefn clear_index_db<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn clear_index_db<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Removes all data from all tables in the index database.
§Returns
A Result
indicating the success or failure of the operation.
Sourcefn get_safe_hopr_balance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn get_safe_hopr_balance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Gets node’s Safe balance of HOPR tokens.
Sourcefn set_safe_hopr_balance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
new_balance: Balance,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn set_safe_hopr_balance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
new_balance: Balance,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Sets node’s Safe balance of HOPR tokens.
Sourcefn get_safe_hopr_allowance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn get_safe_hopr_allowance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<Balance>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Gets node’s Safe allowance of HOPR tokens.
Sourcefn set_safe_hopr_allowance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
new_allowance: Balance,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn set_safe_hopr_allowance<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
new_allowance: Balance,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Sets node’s Safe allowance of HOPR tokens.
Sourcefn get_safe_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<Option<SafeInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn get_safe_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<Option<SafeInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Gets node’s Safe addresses info.
Sourcefn set_safe_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
safe_info: SafeInfo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn set_safe_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
safe_info: SafeInfo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Sets node’s Safe addresses info.
Sourcefn get_indexer_data<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<IndexerData>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn get_indexer_data<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<IndexerData>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Gets stored Indexer data (either from the cache or from the DB).
To update information stored in IndexerData, use the individual setter methods,
such as HoprDbInfoOperations::set_domain_separator
… etc.
Sourcefn set_domain_separator<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
dst_type: DomainSeparator,
value: Hash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn set_domain_separator<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
dst_type: DomainSeparator,
value: Hash,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Sets a domain separator.
To retrieve stored domain separator info, use HoprDbInfoOperations::get_indexer_data
,
note that this setter should invalidate the cache.
Sourcefn set_minimum_incoming_ticket_win_prob<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
win_prob: f64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn set_minimum_incoming_ticket_win_prob<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
win_prob: f64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Sets the minimum required winning probability for incoming tickets. The value must be between zero and 1.
Sourcefn update_ticket_price<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
price: Balance,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn update_ticket_price<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
price: Balance,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Updates the ticket price.
To retrieve the stored ticket price, use HoprDbInfoOperations::get_indexer_data
,
note that this setter should invalidate the cache.
Sourcefn get_indexer_state_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<IndexerStateInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn get_indexer_state_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
) -> Pin<Box<dyn Future<Output = Result<IndexerStateInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Gets the indexer state info.
Sourcefn set_indexer_state_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
block_num: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn set_indexer_state_info<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
block_num: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Updates the indexer state info.
Sourcefn set_network_registry_enabled<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
enabled: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn set_network_registry_enabled<'a, 'async_trait>(
&'a self,
tx: OptTx<'a>,
enabled: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Updates the network registry state.
To retrieve the stored network registry state, use HoprDbInfoOperations::get_indexer_data
,
note that this setter should invalidate the cache.
Sourcefn get_global_setting<'a, 'life0, 'async_trait>(
&'a self,
tx: OptTx<'a>,
key: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<[u8]>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn get_global_setting<'a, 'life0, 'async_trait>(
&'a self,
tx: OptTx<'a>,
key: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<[u8]>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Gets global setting value with the given key.
Sourcefn set_global_setting<'a, 'life0, 'life1, 'async_trait>(
&'a self,
tx: OptTx<'a>,
key: &'life0 str,
value: Option<&'life1 [u8]>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_global_setting<'a, 'life0, 'life1, 'async_trait>(
&'a self,
tx: OptTx<'a>,
key: &'life0 str,
value: Option<&'life1 [u8]>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sets the global setting value with the given key.
If the setting with the given key
does not exist, it is created.
If value
is None
and a setting with the given key
exists, it is removed.