Struct erpc_scanner::scanner::Scanner
source · pub struct Scanner { /* private fields */ }
Expand description
A utility to test for two hop circuits
It’s mainly used for completing the IncompleteWork into CompletedWork by attempting to create a circuit,
it distributes the IncompleteWork provided to it through the push_incomplete_work
method, among all the Client
it has spawned internally. These Client
basically hold clones of CircMgr
and underneath they call the method to build circuit through the CircuitBuilder
abstracted by
CircMgr
If we were to push 1000 IncompleteWork into internal channel of the Scanner, then the speed
of completion of those work whould depend mainly on no of clients we spawned within the
Scanner, which can be controlled by passing a u8
value inside of Scanner::new()
Implementations§
source§impl Scanner
impl Scanner
sourcepub async fn new(
no_of_parallel_circuit_builds: u32,
netdir_provider: Arc<NetDirProvider>,
circmgr: Arc<CircMgr<PreferredRuntime>>
) -> Result<Self>
pub async fn new( no_of_parallel_circuit_builds: u32, netdir_provider: Arc<NetDirProvider>, circmgr: Arc<CircMgr<PreferredRuntime>> ) -> Result<Self>
Create a Scanner, behind the scenes it creates a single arti TorClient
and
it’s DirMgr
, CircMgr
is used for all the so called Client
We only have to provide no of Client
we wanna spin in the pool, just make sure it’s not 0
sourcepub fn push_incomplete_work(&self, work: IncompleteWork) -> Result<()>
pub fn push_incomplete_work(&self, work: IncompleteWork) -> Result<()>
Push IncompleteWork into the internal buffer of the Scanner
sourcepub async fn recv_completed_work(&self) -> Option<CompletedWork>
pub async fn recv_completed_work(&self) -> Option<CompletedWork>
Receive the CompletedWork over time from the internal buffer of the Scanner
Auto Trait Implementations§
impl !RefUnwindSafe for Scanner
impl Send for Scanner
impl Sync for Scanner
impl Unpin for Scanner
impl !UnwindSafe for Scanner
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.