SendMany

Trait SendMany 

Source
pub trait SendMany {
    type Exec: MpcExecution<Msg = Self::Msg, SendErr = Self::SendErr>;
    type Msg;
    type SendErr;

    // Required methods
    async fn send(
        &mut self,
        msg: Outgoing<Self::Msg>,
    ) -> Result<(), Self::SendErr>;
    async fn flush(self) -> Result<Self::Exec, Self::SendErr>;

    // Provided methods
    async fn send_p2p(
        &mut self,
        recipient: PartyIndex,
        msg: Self::Msg,
    ) -> Result<(), Self::SendErr> { ... }
    async fn send_to_all(&mut self, msg: Self::Msg) -> Result<(), Self::SendErr> { ... }
    async fn reliably_broadcast(
        &mut self,
        msg: Self::Msg,
    ) -> Result<(), Self::SendErr> { ... }
}
Expand description

Buffer, optimized for sending many messages at once

It’s obtained by calling MpcExecution::send_many, which takes ownership of MpcExecution. To reclaim ownership, call SendMany::flush.

Required Associated Types§

Source

type Exec: MpcExecution<Msg = Self::Msg, SendErr = Self::SendErr>

MPC executor, returned after successful .flush()

Source

type Msg

Protocol message

Source

type SendErr

Error indicating that sending a message has failed

Required Methods§

Source

async fn send(&mut self, msg: Outgoing<Self::Msg>) -> Result<(), Self::SendErr>

Adds a message to the sending queue

Similar to MpcExecution::send, but possibly buffers a message until .flush() is called.

A call to this function may send the message, but this is not guaranteed by the API. To flush the sending queue and send all messages, use .flush().

Source

async fn flush(self) -> Result<Self::Exec, Self::SendErr>

Flushes internal buffer by sending all messages in the queue

Provided Methods§

Source

async fn send_p2p( &mut self, recipient: PartyIndex, msg: Self::Msg, ) -> Result<(), Self::SendErr>

Adds a p2p message to the sending queue

Similar to MpcExecution::send_p2p, but possibly buffers a message until .flush() is called.

A call to this function may send the message, but this is not guaranteed by the API. To flush the sending queue and send all messages, use .flush().

Source

async fn send_to_all(&mut self, msg: Self::Msg) -> Result<(), Self::SendErr>

Adds a broadcast message to the sending queue

Similar to MpcExecution::send_to_all, but possibly buffers a message until .flush() is called.

A call to this function may send the message, but this is not guaranteed by the API. To flush the sending queue and send all messages, use .flush().

Source

async fn reliably_broadcast( &mut self, msg: Self::Msg, ) -> Result<(), Self::SendErr>

Adds a reliable broadcast message to the sending queue

Similar to MpcExecution::reliably_broadcast, but possibly buffers a message until .flush() is called.

A call to this function may send the message, but this is not guaranteed by the API. To flush the sending queue and send all messages, use Self::flush

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<D, M, MainMsg> SendMany for WithEchoBroadcast<D, M, MainMsg>
where D: Digest + 'static, M: SendMany<Msg = Msg<D, MainMsg>>, MainMsg: ProtocolMsg + Digestable + Clone + 'static,

Available on crate feature echo-broadcast only.
Source§

type Exec = WithEchoBroadcast<D, <M as SendMany>::Exec, MainMsg>

Source§

type Msg = MainMsg

Source§

type SendErr = Error<<M as SendMany>::SendErr>

Source§

impl<M, D, E, AsyncR> SendMany for SendMany<M, D, AsyncR>
where M: ProtocolMsg + 'static, D: Stream<Item = Result<Incoming<M>, E>> + Unpin + Sink<Outgoing<M>, Error = E>, AsyncR: AsyncRuntime,

Source§

type Exec = MpcParty<M, D, AsyncR, true>

Source§

type Msg = <MpcParty<M, D, AsyncR> as Mpc>::Msg

Source§

type SendErr = <MpcParty<M, D, AsyncR> as Mpc>::SendErr