tdn_permission

Struct CAPermissionedGroup

Source
pub struct CAPermissionedGroup<P: Peer> { /* private fields */ }

Implementations§

Source§

impl<P: Peer> CAPermissionedGroup<P>

Source

pub fn new( id: GroupId, my_pk: P::PublicKey, my_prove: P::Signature, ca: P::PublicKey, ) -> Self

Source

pub fn new_with_name( id: GroupId, my_pk: P::PublicKey, my_prove: P::Signature, ca: P::PublicKey, my_name: impl ToString, ) -> Self

Source

pub fn peers(&self) -> Vec<&PeerAddr>

Source

pub fn get_peer_addr(&self, name: &String) -> Option<&PeerAddr>

Source

pub fn add( &mut self, peer_addr: PeerAddr, pk: P::PublicKey, sign: P::Signature, addr: SocketAddr, )

directly add a peer to group.

Source

pub fn join_bytes(&self) -> Vec<u8>

Source

pub fn sign_prove( sk: &P::SecretKey, pk: &P::PublicKey, ) -> Result<P::Signature, Box<dyn Error>>

Source

pub async fn join( &mut self, peer_addr: PeerAddr, addr: SocketAddr, join_bytes: Vec<u8>, return_sender: Sender<SendMessage>, )

join: when peer join will call

Source

pub fn join_result( &mut self, peer_addr: PeerAddr, is_ok: bool, _join_result: Vec<u8>, )

Source

pub fn leave(&mut self, peer_addr: &PeerAddr)

leave: when peer leave will call

Trait Implementations§

Source§

impl<P: Debug + Peer> Debug for CAPermissionedGroup<P>
where P::PublicKey: Debug, P::Signature: Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<P: Default + Peer> Default for CAPermissionedGroup<P>

Source§

fn default() -> CAPermissionedGroup<P>

Returns the “default value” for a type. Read more
Source§

impl<P: Peer> Group for CAPermissionedGroup<P>

Source§

type JoinType = (<P as Peer>::PublicKey, <P as Peer>::Signature)

define join_data’s type.
Source§

type JoinResultType = ()

define join_result_data’s type.
Source§

fn id(&self) -> &GroupId

get the group id, defined in TDN

Auto Trait Implementations§

§

impl<P> Freeze for CAPermissionedGroup<P>
where <P as Peer>::PublicKey: Freeze, <P as Peer>::Signature: Freeze,

§

impl<P> RefUnwindSafe for CAPermissionedGroup<P>

§

impl<P> Send for CAPermissionedGroup<P>
where <P as Peer>::PublicKey: Send, <P as Peer>::Signature: Send,

§

impl<P> Sync for CAPermissionedGroup<P>
where <P as Peer>::PublicKey: Sync, <P as Peer>::Signature: Sync,

§

impl<P> Unpin for CAPermissionedGroup<P>
where <P as Peer>::PublicKey: Unpin, <P as Peer>::Signature: Unpin,

§

impl<P> UnwindSafe for CAPermissionedGroup<P>
where <P as Peer>::PublicKey: UnwindSafe, <P as Peer>::Signature: UnwindSafe,

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.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.