pub struct ComponentTracker<R: RPCClient> {
pub components: HashMap<String, ProtocolComponent>,
pub contracts: HashSet<Bytes>,
/* private fields */
}Expand description
Helper struct to store which components are being tracked atm.
Fields§
§components: HashMap<String, ProtocolComponent>§contracts: HashSet<Bytes>derived from tracked components, we need this if subscribed to a vm extractor cause updates are emitted on a contract level instead of on a component level.
Implementations§
Source§impl<R> ComponentTracker<R>where
R: RPCClient,
impl<R> ComponentTracker<R>where
R: RPCClient,
pub fn new( chain: Chain, protocol_system: &str, filter: ComponentFilter, rpc: R, ) -> Self
Sourcepub async fn initialise_components(&mut self) -> Result<(), RPCError>
pub async fn initialise_components(&mut self) -> Result<(), RPCError>
Retrieve all components that belong to the system we are extracing and have sufficient tvl.
Sourcepub async fn start_tracking(
&mut self,
new_components: &[&String],
) -> Result<(), RPCError>
pub async fn start_tracking( &mut self, new_components: &[&String], ) -> Result<(), RPCError>
Add a new component to be tracked
Sourcepub fn stop_tracking<'a, I: IntoIterator<Item = &'a String> + Debug>(
&mut self,
to_remove: I,
) -> HashMap<String, ProtocolComponent>
pub fn stop_tracking<'a, I: IntoIterator<Item = &'a String> + Debug>( &mut self, to_remove: I, ) -> HashMap<String, ProtocolComponent>
Stop tracking components
pub fn get_contracts_by_component<'a, I: IntoIterator<Item = &'a String>>( &self, ids: I, ) -> HashSet<Bytes>
pub fn get_tracked_component_ids(&self) -> Vec<String>
Sourcepub fn filter_updated_components(
&self,
deltas: &BlockChanges,
) -> (Vec<String>, Vec<String>)
pub fn filter_updated_components( &self, deltas: &BlockChanges, ) -> (Vec<String>, Vec<String>)
Given BlockChanges, filter out components that are no longer relevant and return the components that need to be added or removed.
Auto Trait Implementations§
impl<R> Freeze for ComponentTracker<R>where
R: Freeze,
impl<R> RefUnwindSafe for ComponentTracker<R>where
R: RefUnwindSafe,
impl<R> Send for ComponentTracker<R>
impl<R> Sync for ComponentTracker<R>
impl<R> Unpin for ComponentTracker<R>where
R: Unpin,
impl<R> UnwindSafe for ComponentTracker<R>where
R: UnwindSafe,
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