mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
feat(rpc): add query methods to ActiveFilters (#22275)
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -759,6 +759,26 @@ impl<T> ActiveFilters<T> {
|
||||
pub fn new() -> Self {
|
||||
Self { inner: Arc::new(Mutex::new(HashMap::default())) }
|
||||
}
|
||||
|
||||
/// Returns `true` if a filter with the given id exists.
|
||||
pub async fn contains(&self, id: &FilterId) -> bool {
|
||||
self.inner.lock().await.contains_key(id)
|
||||
}
|
||||
|
||||
/// Returns the number of currently active filters.
|
||||
pub async fn len(&self) -> usize {
|
||||
self.inner.lock().await.len()
|
||||
}
|
||||
|
||||
/// Returns `true` if there are no active filters.
|
||||
pub async fn is_empty(&self) -> bool {
|
||||
self.inner.lock().await.is_empty()
|
||||
}
|
||||
|
||||
/// Returns all active filter ids.
|
||||
pub async fn ids(&self) -> Vec<FilterId> {
|
||||
self.inner.lock().await.keys().cloned().collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// An installed filter
|
||||
|
||||
Reference in New Issue
Block a user