Struct indy_vdr::pool::PoolRunner
source · pub struct PoolRunner { /* private fields */ }
Expand description
The PoolRunner
instance creates a separate thread for handling pool events,
allowing the use of callbacks instead of async functions for interacting
with the pool as well as simplifying validator pool refreshes.
Implementations§
source§impl PoolRunner
impl PoolRunner
sourcepub fn new<F>(
config: PoolConfig,
merkle_tree: MerkleTree,
networker_factory: F,
node_weights: Option<HashMap<String, f32>>,
refreshed: bool,
cache: Option<Cache<String, (String, RequestResultMeta)>>
) -> Self
pub fn new<F>( config: PoolConfig, merkle_tree: MerkleTree, networker_factory: F, node_weights: Option<HashMap<String, f32>>, refreshed: bool, cache: Option<Cache<String, (String, RequestResultMeta)>> ) -> Self
Create a new PoolRunner
instance and run the associated worker thread.
sourcepub fn get_status(
&self,
callback: Box<dyn FnOnce(VdrResult<PoolRunnerStatus>) + Send>
) -> VdrResult<()>
pub fn get_status( &self, callback: Box<dyn FnOnce(VdrResult<PoolRunnerStatus>) + Send> ) -> VdrResult<()>
Fetch the status of the pool instance.
sourcepub fn get_transactions(
&self,
callback: Box<dyn FnOnce(VdrResult<Vec<String>>) + Send>
) -> VdrResult<()>
pub fn get_transactions( &self, callback: Box<dyn FnOnce(VdrResult<Vec<String>>) + Send> ) -> VdrResult<()>
Fetch the current set of pool transactions.
sourcepub fn get_verifiers(
&self,
callback: Box<dyn FnOnce(VdrResult<Verifiers>) + Send>
) -> VdrResult<()>
pub fn get_verifiers( &self, callback: Box<dyn FnOnce(VdrResult<Verifiers>) + Send> ) -> VdrResult<()>
Fetch the current set of pool transactions.
sourcepub fn refresh(
&self,
callback: Box<dyn FnOnce(VdrResult<(Option<PoolTransactions>, RequestResultMeta)>) + Send>
) -> VdrResult<()>
pub fn refresh( &self, callback: Box<dyn FnOnce(VdrResult<(Option<PoolTransactions>, RequestResultMeta)>) + Send> ) -> VdrResult<()>
Fetch the latest pool transactions and switch to the new validator pool if necessary.
sourcepub fn send_request(
&self,
request: PreparedRequest,
callback: Box<dyn FnOnce(VdrResult<(RequestResult<String>, RequestResultMeta)>) + Send>
) -> VdrResult<()>
pub fn send_request( &self, request: PreparedRequest, callback: Box<dyn FnOnce(VdrResult<(RequestResult<String>, RequestResultMeta)>) + Send> ) -> VdrResult<()>
Submit a request to the validator pool.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PoolRunner
impl !RefUnwindSafe for PoolRunner
impl Send for PoolRunner
impl Sync for PoolRunner
impl Unpin for PoolRunner
impl !UnwindSafe for PoolRunner
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more