pub struct BParticipant {
    local_pid: Pid,
    remote_pid: Pid,
    remote_pid_string: String,
    offset_sid: Sid,
    channels: Arc<RwLock<HashMap<Cid, Mutex<ChannelInfo>>>>,
    streams: RwLock<HashMap<Sid, StreamInfo>>,
    run_channels: Option<ControlChannels>,
    shutdown_barrier: AtomicI32,
    metrics: Arc<NetworkMetrics>,
    open_stream_channels: Arc<Mutex<Option<OpenStreamInfo>>>,
}

Fields§

§local_pid: Pid§remote_pid: Pid§remote_pid_string: String§offset_sid: Sid§channels: Arc<RwLock<HashMap<Cid, Mutex<ChannelInfo>>>>§streams: RwLock<HashMap<Sid, StreamInfo>>§run_channels: Option<ControlChannels>§shutdown_barrier: AtomicI32§metrics: Arc<NetworkMetrics>§open_stream_channels: Arc<Mutex<Option<OpenStreamInfo>>>

Implementations§

source§

impl BParticipant

source

const BARR_CHANNEL: i32 = 1i32

source

const BARR_RECV: i32 = 4i32

source

const BARR_SEND: i32 = 2i32

source

const TICK_TIME: Duration = _

source

const TICK_TIME_MS: u64 = 5u64

source

pub(crate) fn new( local_pid: Pid, remote_pid: Pid, offset_sid: Sid, metrics: Arc<NetworkMetrics> ) -> (Self, UnboundedSender<(Prio, Promises, Bandwidth, Sender<Stream>)>, UnboundedReceiver<Stream>, UnboundedReceiver<ParticipantEvent>, UnboundedSender<(Cid, Sid, Protocols, ConnectAddr, Sender<()>)>, Sender<(Duration, Sender<Result<(), ParticipantError>>)>, Receiver<f32>)

source

pub async fn run(self, b2s_prio_statistic_s: UnboundedSender<(Pid, u64, u64)>)

source

fn best_protocol( all: &SortedVec<Cid, SendProtocols>, promises: Promises ) -> Option<Cid>

source

async fn send_mgr( &self, a2b_open_stream_r: UnboundedReceiver<(Prio, Promises, Bandwidth, Sender<Stream>)>, a2b_close_stream_r: UnboundedReceiver<Sid>, a2b_msg_r: Receiver<(Sid, Bytes)>, b2b_add_protocol_r: UnboundedReceiver<(Cid, SendProtocols)>, b2b_close_send_protocol_r: Receiver<Cid>, b2b_notify_send_of_recv_open_r: Receiver<(Cid, Sid, Prio, Promises, Bandwidth)>, b2b_notify_send_of_recv_close_r: Receiver<(Cid, Sid)>, b2a_event_s: UnboundedSender<ParticipantEvent>, _b2s_prio_statistic_s: UnboundedSender<(Pid, u64, u64)>, b2a_bandwidth_stats_s: Sender<f32> )

source

async fn recv_mgr( &self, b2a_stream_opened_s: UnboundedSender<Stream>, b2b_add_protocol_r: UnboundedReceiver<(Cid, RecvProtocols)>, b2b_force_close_recv_protocol_r: Receiver<Cid>, b2b_close_send_protocol_s: Sender<Cid>, b2b_notify_send_of_recv_open_r: Sender<(Cid, Sid, Prio, Promises, Bandwidth)>, b2b_notify_send_of_recv_close_s: Sender<(Cid, Sid)> )

source

async fn create_channel_mgr( &self, s2b_create_channel_r: UnboundedReceiver<(Cid, Sid, Protocols, ConnectAddr, Sender<()>)>, b2b_add_send_protocol_s: UnboundedSender<(Cid, SendProtocols)>, b2b_add_recv_protocol_s: UnboundedSender<(Cid, RecvProtocols)>, b2a_event_s: UnboundedSender<ParticipantEvent> )

source

async fn participant_shutdown_mgr( &self, s2b_shutdown_bparticipant_r: Receiver<(Duration, Sender<Result<(), ParticipantError>>)>, b2b_close_send_protocol_s: Sender<Cid>, b2b_force_close_recv_protocol_s: Sender<Cid> )

sink shutdown: Situation AS, AR, BS, BR. A wants to close. AS shutdown. BR notices shutdown and tries to stops BS. (success) BS shutdown AR notices shutdown and tries to stop AS. (fails) For the case where BS didn’t get shutdowned, e.g. by a handing situation on the remote, we have a timeout to also force close AR.

This fn will:

    1. stop api to interact with bparticipant by closing sendmsg and openstream
    1. stop the send_mgr (it will take care of clearing the queue and finish with a Shutdown)
  • (3). force stop recv after 60 seconds
  • (4). this fn finishes last and afterwards BParticipant drops

before calling this fn, make sure s2b_create_channel is closed! If BParticipant kills itself managers stay active till this function is called by api to get the result status

source

async fn delete_stream(&self, sid: Sid)

Stopping API and participant usage Protocol will take care of the order of the frame

source

async fn create_stream( &self, sid: Sid, prio: Prio, promises: Promises, guaranteed_bandwidth: Bandwidth ) -> Stream

Trait Implementations§

source§

impl Debug for BParticipant

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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