pub struct Engine<E: Clock + GClock + Spawner + Rng + Metrics, P: Array, D: Coordinator<PublicKey = P>, Key: Array, Con: Consumer<Key = Key, Value = Bytes, Failure = ()>, Pro: Producer<Key = Key>, NetS: Sender<PublicKey = P>, NetR: Receiver<PublicKey = P>> { /* private fields */ }
Expand description
Manages incoming and outgoing P2P requests, coordinating fetch and serve operations.
Implementations§
Source§impl<E: Clock + GClock + Spawner + Rng + Metrics, P: Array, D: Coordinator<PublicKey = P>, Key: Array, Con: Consumer<Key = Key, Value = Bytes, Failure = ()>, Pro: Producer<Key = Key>, NetS: Sender<PublicKey = P>, NetR: Receiver<PublicKey = P>> Engine<E, P, D, Key, Con, Pro, NetS, NetR>
impl<E: Clock + GClock + Spawner + Rng + Metrics, P: Array, D: Coordinator<PublicKey = P>, Key: Array, Con: Consumer<Key = Key, Value = Bytes, Failure = ()>, Pro: Producer<Key = Key>, NetS: Sender<PublicKey = P>, NetR: Receiver<PublicKey = P>> Engine<E, P, D, Key, Con, Pro, NetS, NetR>
Sourcepub fn new(context: E, cfg: Config<P, D, Key, Con, Pro>) -> (Self, Mailbox<Key>)
pub fn new(context: E, cfg: Config<P, D, Key, Con, Pro>) -> (Self, Mailbox<Key>)
Creates a new Actor
with the given configuration.
Returns the actor and a mailbox to send messages to it.
Sourcepub fn start(self, network: (NetS, NetR)) -> Handle<()>
pub fn start(self, network: (NetS, NetR)) -> Handle<()>
Runs the actor until the context is stopped.
The actor will handle:
- Fetching data from other peers and notifying the
Consumer
- Serving data to other peers by requesting it from the
Producer
Auto Trait Implementations§
impl<E, P, D, Key, Con, Pro, NetS, NetR> !Freeze for Engine<E, P, D, Key, Con, Pro, NetS, NetR>
impl<E, P, D, Key, Con, Pro, NetS, NetR> !RefUnwindSafe for Engine<E, P, D, Key, Con, Pro, NetS, NetR>
impl<E, P, D, Key, Con, Pro, NetS, NetR> Send for Engine<E, P, D, Key, Con, Pro, NetS, NetR>
impl<E, P, D, Key, Con, Pro, NetS, NetR> !Sync for Engine<E, P, D, Key, Con, Pro, NetS, NetR>
impl<E, P, D, Key, Con, Pro, NetS, NetR> Unpin for Engine<E, P, D, Key, Con, Pro, NetS, NetR>
impl<E, P, D, Key, Con, Pro, NetS, NetR> !UnwindSafe for Engine<E, P, D, Key, Con, Pro, NetS, NetR>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more