pub struct NetworkActor { /* private fields */ }Expand description
The network actor handles two core networking components of the rollup node:
- discovery: Peer discovery over UDP using discv5.
- gossip: Block gossip over TCP using libp2p.
The network actor itself is a light wrapper around the NetworkBuilder.
§Example
ⓘ
use kona_p2p::NetworkDriver;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
let chain_id = 10;
let signer = Address::random();
let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), 9099);
// Construct the `Network` using the builder.
// let mut driver = Network::builder()
// .with_unsafe_block_signer(signer)
// .with_chain_id(chain_id)
// .with_gossip_addr(socket)
// .build()
// .unwrap();
// Construct the `NetworkActor` with the [`Network`].
// let actor = NetworkActor::new(driver);Implementations§
Source§impl NetworkActor
impl NetworkActor
Sourcepub fn new(driver: NetworkBuilder) -> (NetworkInboundData, Self)
pub fn new(driver: NetworkBuilder) -> (NetworkInboundData, Self)
Constructs a new NetworkActor given the NetworkBuilder
Trait Implementations§
Source§impl Debug for NetworkActor
impl Debug for NetworkActor
Source§impl NodeActor for NetworkActor
impl NodeActor for NetworkActor
Source§type Error = NetworkActorError
type Error = NetworkActorError
The error type for the actor.
Source§type InboundData = NetworkInboundData
type InboundData = NetworkInboundData
The inbound communication channels used by the actor.
These are the channels that the actor will use to receive messages from other actors.
Source§type OutboundData = NetworkContext
type OutboundData = NetworkContext
The communication context used by the actor.
These are the channels that the actor will use to send messages to other actors.
Source§type Builder = NetworkBuilder
type Builder = NetworkBuilder
The configuration needed to build the actor.
Source§fn build(state: Self::Builder) -> (Self::InboundData, Self)
fn build(state: Self::Builder) -> (Self::InboundData, Self)
Builds the actor.
Auto Trait Implementations§
impl Freeze for NetworkActor
impl !RefUnwindSafe for NetworkActor
impl Send for NetworkActor
impl Sync for NetworkActor
impl Unpin for NetworkActor
impl !UnwindSafe for NetworkActor
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> 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