Struct network_clique::Service

source ·
pub struct Service<SK: SecretKey, D: Data, A: Data, ND: Dialer<A>, NL: Listener, SH: SpawnHandleT>
where SK::PublicKey: PeerId,
{ commands_from_interface: UnboundedReceiver<ServiceCommand<SK::PublicKey, D, A>>, next_to_interface: UnboundedSender<D>, manager: Manager<SK::PublicKey, A, D>, dialer: ND, listener: NL, spawn_handle: SH, secret_key: SK, metrics: Metrics, }
Expand description

A service that has to be run for the clique network to work.

Fields§

§commands_from_interface: UnboundedReceiver<ServiceCommand<SK::PublicKey, D, A>>§next_to_interface: UnboundedSender<D>§manager: Manager<SK::PublicKey, A, D>§dialer: ND§listener: NL§spawn_handle: SH§secret_key: SK§metrics: Metrics

Implementations§

source§

impl<SK: SecretKey, D: Data, A: Data + Debug, ND: Dialer<A>, NL: Listener, SH: SpawnHandleT> Service<SK, D, A, ND, NL, SH>
where SK::PublicKey: PeerId,

source

pub fn new( dialer: ND, listener: NL, secret_key: SK, spawn_handle: SH, metrics_registry: Option<Registry> ) -> (Self, impl Network<SK::PublicKey, A, D>)

Create a new clique network service plus an interface for interacting with it.

source

fn spawn_new_outgoing( &mut self, public_key: SK::PublicKey, address: A, result_for_parent: UnboundedSender<(SK::PublicKey, Option<UnboundedSender<D>>)> )

source

fn spawn_new_incoming( &self, stream: NL::Connection, result_for_parent: UnboundedSender<(SK::PublicKey, Option<UnboundedSender<D>>)>, authorization_requests_sender: UnboundedSender<(SK::PublicKey, Sender<bool>)> )

source

fn peer_address(&self, public_key: &SK::PublicKey) -> Option<A>

source

fn add_connection( &mut self, public_key: SK::PublicKey, data_for_network: UnboundedSender<D> ) -> AddResult

source

pub async fn run(self, exit: Receiver<()>)

Run the service until a signal from exit.

Auto Trait Implementations§

§

impl<SK, D, A, ND, NL, SH> !RefUnwindSafe for Service<SK, D, A, ND, NL, SH>

§

impl<SK, D, A, ND, NL, SH> Send for Service<SK, D, A, ND, NL, SH>
where NL: Send, SH: Send,

§

impl<SK, D, A, ND, NL, SH> Sync for Service<SK, D, A, ND, NL, SH>
where ND: Sync, NL: Sync, SH: Sync,

§

impl<SK, D, A, ND, NL, SH> Unpin for Service<SK, D, A, ND, NL, SH>
where A: Unpin, ND: Unpin, NL: Unpin, SH: Unpin, SK: Unpin, <SK as SecretKey>::PublicKey: Unpin,

§

impl<SK, D, A, ND, NL, SH> !UnwindSafe for Service<SK, D, A, ND, NL, SH>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more