[][src]Enum chamomile_types::message::SendMessage

pub enum SendMessage {
    PeerJoinResult(PeerIdboolboolVec<u8>),
    PeerConnect(PeerIdOption<SocketAddr>, Vec<u8>),
    PeerDisconnect(PeerId),
    Connect(SocketAddrOption<Vec<u8>>),
    DisConnect(SocketAddr),
    Data(PeerIdVec<u8>),
    Broadcast(BroadcastVec<u8>),
    Stream(u32StreamType),
}

main send message for outside channel, send from outside to chamomile.

Variants

PeerJoinResult(PeerIdboolboolVec<u8>)

(permissioned only) when peer request for join, outside decide connect or not. params is peer_id, is_connect, is_force_close, result info. if is_connect is true, it will add to white directly list. we want to build a better network, add a is_force_close. if is_connect is false, but is_force_close if true, we will use this peer to build our DHT for better connection. if false, we will force close it.

PeerConnect(PeerIdOption<SocketAddr>, Vec<u8>)

when need add a peer to stable connect, send to chamomile from outside. if success connect, will start a stable connection, and add peer to kad, stables, bootstraps and whitelists. if failure, will send PeerLeave to outside. params is peer_id, socket_addr and peer join_info.

PeerDisconnect(PeerId)

when outside want to close a stable connectioned peer. use it force close. params is peer_id.

Connect(SocketAddrOption<Vec<u8>>)

when outside want to connect a peer. will try connect directly. if connected, chamomile will add to kad and bootstrap. if join_info is none, chamomile will use config's join_data as default. params is socket_addr, join_info.

DisConnect(SocketAddr)

when outside donnot want to connect peer. use it to force close. it will remove from kad and bootstrap list. params is socket_addr.

Data(PeerIdVec<u8>)

when need send a data to a peer, only need know the peer_id, the chamomile will help you send data to there. params is peer_id and data_bytes.

Broadcast(BroadcastVec<u8>)

when need broadcast a data to all network, chamomile support some common algorithm, use it, donnot worry. params is broadcast_type and data_bytes

Stream(u32StreamType)

Apply for build a stream between nodes. params is u32 stream symbol, and StreamType.

Trait Implementations

impl Clone for SendMessage[src]

impl Debug for SendMessage[src]

impl Eq for SendMessage[src]

impl PartialEq<SendMessage> for SendMessage[src]

impl StructuralEq for SendMessage[src]

impl StructuralPartialEq for SendMessage[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.