pub struct Engine<E, P, D, B, Key, Con, Pro, NetS, NetR>where
E: BufferPooler + Clock + Spawner + Rng + Metrics,
P: PublicKey,
D: Provider<PublicKey = P>,
B: Blocker<PublicKey = P>,
Key: Span,
Con: Consumer<Key = Key, Value = Bytes>,
Pro: Producer<Key = Key>,
NetS: Sender<PublicKey = P>,
NetR: Receiver<PublicKey = P>,
Con::Subscriber: Eq,{ /* private fields */ }Expand description
Manages incoming and outgoing P2P requests, coordinating fetch and serve operations.
Implementations§
Source§impl<E, P, D, B, Key, Con, Pro, NetS, NetR> Engine<E, P, D, B, Key, Con, Pro, NetS, NetR>where
E: BufferPooler + Clock + Spawner + Rng + Metrics,
P: PublicKey,
D: Provider<PublicKey = P>,
B: Blocker<PublicKey = P>,
Key: Span,
Con: Consumer<Key = Key, Value = Bytes>,
Pro: Producer<Key = Key>,
NetS: Sender<PublicKey = P>,
NetR: Receiver<PublicKey = P>,
Con::Subscriber: Clone + Ord + Send + 'static,
impl<E, P, D, B, Key, Con, Pro, NetS, NetR> Engine<E, P, D, B, Key, Con, Pro, NetS, NetR>where
E: BufferPooler + Clock + Spawner + Rng + Metrics,
P: PublicKey,
D: Provider<PublicKey = P>,
B: Blocker<PublicKey = P>,
Key: Span,
Con: Consumer<Key = Key, Value = Bytes>,
Pro: Producer<Key = Key>,
NetS: Sender<PublicKey = P>,
NetR: Receiver<PublicKey = P>,
Con::Subscriber: Clone + Ord + Send + 'static,
Sourcepub fn new(
context: E,
cfg: Config<P, D, B, Key, Con, Pro>,
) -> (Self, Mailbox<Key, P, Con::Subscriber>)
pub fn new( context: E, cfg: Config<P, D, B, Key, Con, Pro>, ) -> (Self, Mailbox<Key, P, Con::Subscriber>)
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, B, Key, Con, Pro, NetS, NetR> !Freeze for Engine<E, P, D, B, Key, Con, Pro, NetS, NetR>
impl<E, P, D, B, Key, Con, Pro, NetS, NetR> !RefUnwindSafe for Engine<E, P, D, B, Key, Con, Pro, NetS, NetR>
impl<E, P, D, B, Key, Con, Pro, NetS, NetR> Send for Engine<E, P, D, B, Key, Con, Pro, NetS, NetR>
impl<E, P, D, B, Key, Con, Pro, NetS, NetR> !Sync for Engine<E, P, D, B, Key, Con, Pro, NetS, NetR>
impl<E, P, D, B, Key, Con, Pro, NetS, NetR> Unpin for Engine<E, P, D, B, Key, Con, Pro, NetS, NetR>
impl<E, P, D, B, Key, Con, Pro, NetS, NetR> UnsafeUnpin for Engine<E, P, D, B, Key, Con, Pro, NetS, NetR>where
Pro: UnsafeUnpin,
D: UnsafeUnpin,
B: UnsafeUnpin,
E: UnsafeUnpin,
P: UnsafeUnpin,
Con: UnsafeUnpin,
impl<E, P, D, B, Key, Con, Pro, NetS, NetR> !UnwindSafe for Engine<E, P, D, B, 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