pub struct Session { /* private fields */ }Expand description
One session as seen from this node: a project, and the key this node signs with.
Implementations§
Source§impl Session
impl Session
Sourcepub fn host(id: &str, me: Keypair, now: i64) -> Result<Session, SessionError>
pub fn host(id: &str, me: Keypair, now: i64) -> Result<Session, SessionError>
Start a session this node hosts.
Sourcepub fn standalone(
id: &str,
me: Keypair,
now: i64,
) -> Result<Session, SessionError>
pub fn standalone( id: &str, me: Keypair, now: i64, ) -> Result<Session, SessionError>
Standalone host mode: one session, one host, new people join as Viewers after the host
approves them. Same as Session::host; use Session::quick_link to share it.
Sourcepub fn resume(project: Project, me: Keypair) -> Session
pub fn resume(project: Project, me: Keypair) -> Session
Pick up a session saved earlier, or a copy of one this node joined. me is this node’s
key: the host’s key on the host, a member’s own key on theirs. The project keeps its own
role table, so a project saved by an older build keeps the roles it had.
Sourcepub fn into_project(self) -> Project
pub fn into_project(self) -> Project
The project, to save it; Session::resume picks it up again.
Sourcepub fn project_mut(&mut self) -> &mut Project
pub fn project_mut(&mut self) -> &mut Project
The project, to apply records that arrive from other nodes.
A link for role that works for ttl_ms and, if given, max_uses people. It names this
node as the host; add dial hints with JoinLink::with_addrs.
Sourcepub fn quick_link(&mut self, now: i64) -> Result<JoinLink, SessionError>
pub fn quick_link(&mut self, now: i64) -> Result<JoinLink, SessionError>
The standalone default: a Viewer link for a day, the host approves each person.
Sourcepub fn invite_contact(
&mut self,
user: &UserId,
role: &str,
ttl_ms: i64,
now: i64,
) -> Result<Invite, SessionError>
pub fn invite_contact( &mut self, user: &UserId, role: &str, ttl_ms: i64, now: i64, ) -> Result<Invite, SessionError>
A direct invite to one identity (a contact).
Sourcepub fn join(
&mut self,
link: &JoinLink,
user: &UserId,
now: i64,
) -> Result<Joined, SessionError>
pub fn join( &mut self, link: &JoinLink, user: &UserId, now: i64, ) -> Result<Joined, SessionError>
Someone used a link. The host node decides: in, or waiting for approval.
Sourcepub fn kick(&mut self, user: &UserId, now: i64) -> Result<(), SessionError>
pub fn kick(&mut self, user: &UserId, now: i64) -> Result<(), SessionError>
Remove a member (needs session.manage).
Sourcepub fn ban(&mut self, user: &UserId, now: i64) -> Result<(), SessionError>
pub fn ban(&mut self, user: &UserId, now: i64) -> Result<(), SessionError>
Ban an identity from the session (needs session.manage).
Sourcepub fn hand_over(
&self,
to: &UserId,
kind: HandoverKind,
now: i64,
) -> Result<Handover, SessionError>
pub fn hand_over( &self, to: &UserId, kind: HandoverKind, now: i64, ) -> Result<Handover, SessionError>
As host, sign a handover of the host role to the member to.
Sourcepub fn accept_handover(
&mut self,
h: &Handover,
now: i64,
) -> Result<(), SessionError>
pub fn accept_handover( &mut self, h: &Handover, now: i64, ) -> Result<(), SessionError>
Become host of this copy of the session with a handover the host signed to you.
Sourcepub fn approve(&mut self, user: &UserId, now: i64) -> Result<(), SessionError>
pub fn approve(&mut self, user: &UserId, now: i64) -> Result<(), SessionError>
Let a waiting person in.
Sourcepub fn deny(&mut self, user: &UserId, now: i64) -> Result<(), SessionError>
pub fn deny(&mut self, user: &UserId, now: i64) -> Result<(), SessionError>
Turn a waiting person away.
Sourcepub fn can(&self, who: &UserId, permission: &str, now: i64) -> bool
pub fn can(&self, who: &UserId, permission: &str, now: i64) -> bool
May who do permission? Gated permissions on someone’s audio need
Session::can_audio.
Sourcepub fn explain(&self, who: &UserId, permission: &str, now: i64) -> Explained
pub fn explain(&self, who: &UserId, permission: &str, now: i64) -> Explained
The decision for who and permission with the steps that led to it.
Sourcepub fn can_audio(
&self,
who: &UserId,
permission: &str,
owner: &UserId,
stream: Option<&str>,
now: i64,
) -> Explained
pub fn can_audio( &self, who: &UserId, permission: &str, owner: &UserId, stream: Option<&str>, now: i64, ) -> Explained
May who do permission to owner’s audio (optionally one stream)?
Sourcepub fn consent_request(
&self,
who: &UserId,
permission: &str,
owner: &UserId,
stream: Option<&str>,
now: i64,
) -> Option<ConsentRequest>
pub fn consent_request( &self, who: &UserId, permission: &str, owner: &UserId, stream: Option<&str>, now: i64, ) -> Option<ConsentRequest>
If who would need owner’s consent for this, the request to put to owner.
Sourcepub fn grant(
&mut self,
owner_key: &Keypair,
req: &ConsentRequest,
how: Duration,
now: i64,
) -> Result<(), SessionError>
pub fn grant( &mut self, owner_key: &Keypair, req: &ConsentRequest, how: Duration, now: i64, ) -> Result<(), SessionError>
The owner says yes. owner_key must be the owner’s own key; the grant covers the
requester and the request’s stream (all of the owner’s streams if it named none).
Trait Implementations§
Auto Trait Implementations§
impl Forget for Session
impl Freeze for Sessionwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<RoleId, RoleSpec> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(RoleId, RoleSpec)>>: Freeze,
*const LeafNode<Permission, Gate> is !null: Freeze,
PhantomData<Box<(Permission, Gate)>>: Freeze,
*const LeafNode<UserId, Member> is !null: Freeze,
PhantomData<Box<(UserId, Member)>>: Freeze,
*const LeafNode<UserId, SetValZST> is !null: Freeze,
PhantomData<Box<(UserId, SetValZST)>>: Freeze,
PhantomData<Rule>: Freeze,
PhantomData<ConsentGrant>: Freeze,
*const LeafNode<RecordId, Revocation> is !null: Freeze,
PhantomData<Box<(RecordId, Revocation)>>: Freeze,
*const LeafNode<RecordId, i64> is !null: Freeze,
PhantomData<Box<(RecordId, i64)>>: Freeze,
*const LeafNode<RecordId, InviteState> is !null: Freeze,
PhantomData<Box<(RecordId, InviteState)>>: Freeze,
PhantomData<JoinRequest>: Freeze,
PhantomData<AuditEntry>: Freeze,
PhantomData<AuditDeletion>: Freeze,
PhantomData<Handover>: Freeze,
impl Move for Session
impl RefUnwindSafe for Session
impl Send for Sessionwhere
RawVecInner: Send,
NodeRef<Owned, RoleId, RoleSpec, LeafOrInternal>: Send,
BoxRaw<(RoleId, RoleSpec)>: Send,
NodeRef<Owned, Permission, Gate, LeafOrInternal>: Send,
BoxRaw<(Permission, Gate)>: Send,
NodeRef<Owned, UserId, Member, LeafOrInternal>: Send,
BoxRaw<(UserId, Member)>: Send,
NodeRef<Owned, UserId, SetValZST, LeafOrInternal>: Send,
BoxRaw<(UserId, SetValZST)>: Send,
NodeRef<Owned, RecordId, Revocation, LeafOrInternal>: Send,
BoxRaw<(RecordId, Revocation)>: Send,
NodeRef<Owned, RecordId, i64, LeafOrInternal>: Send,
BoxRaw<(RecordId, i64)>: Send,
NodeRef<Owned, RecordId, InviteState, LeafOrInternal>: Send,
BoxRaw<(RecordId, InviteState)>: Send,
impl Sync for Sessionwhere
RawVecInner: Sync,
NodeRef<Owned, RoleId, RoleSpec, LeafOrInternal>: Sync,
BoxRaw<(RoleId, RoleSpec)>: Sync,
NodeRef<Owned, Permission, Gate, LeafOrInternal>: Sync,
BoxRaw<(Permission, Gate)>: Sync,
NodeRef<Owned, UserId, Member, LeafOrInternal>: Sync,
BoxRaw<(UserId, Member)>: Sync,
NodeRef<Owned, UserId, SetValZST, LeafOrInternal>: Sync,
BoxRaw<(UserId, SetValZST)>: Sync,
NodeRef<Owned, RecordId, Revocation, LeafOrInternal>: Sync,
BoxRaw<(RecordId, Revocation)>: Sync,
NodeRef<Owned, RecordId, i64, LeafOrInternal>: Sync,
BoxRaw<(RecordId, i64)>: Sync,
NodeRef<Owned, RecordId, InviteState, LeafOrInternal>: Sync,
BoxRaw<(RecordId, InviteState)>: Sync,
impl Unpin for Sessionwhere
*const u8 is !null: Unpin,
*const LeafNode<RoleId, RoleSpec> is !null: Unpin,
Box<(RoleId, RoleSpec)>: Unpin,
*const LeafNode<Permission, Gate> is !null: Unpin,
Box<(Permission, Gate)>: Unpin,
*const LeafNode<UserId, Member> is !null: Unpin,
Box<(UserId, Member)>: Unpin,
*const LeafNode<UserId, SetValZST> is !null: Unpin,
Box<(UserId, SetValZST)>: Unpin,
*const LeafNode<RecordId, Revocation> is !null: Unpin,
Box<(RecordId, Revocation)>: Unpin,
*const LeafNode<RecordId, i64> is !null: Unpin,
Box<(RecordId, i64)>: Unpin,
*const LeafNode<RecordId, InviteState> is !null: Unpin,
Box<(RecordId, InviteState)>: Unpin,
impl UnsafeUnpin for Sessionwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<RoleId, RoleSpec> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(RoleId, RoleSpec)>>: UnsafeUnpin,
*const LeafNode<Permission, Gate> is !null: UnsafeUnpin,
PhantomData<Box<(Permission, Gate)>>: UnsafeUnpin,
*const LeafNode<UserId, Member> is !null: UnsafeUnpin,
PhantomData<Box<(UserId, Member)>>: UnsafeUnpin,
*const LeafNode<UserId, SetValZST> is !null: UnsafeUnpin,
PhantomData<Box<(UserId, SetValZST)>>: UnsafeUnpin,
PhantomData<Rule>: UnsafeUnpin,
PhantomData<ConsentGrant>: UnsafeUnpin,
*const LeafNode<RecordId, Revocation> is !null: UnsafeUnpin,
PhantomData<Box<(RecordId, Revocation)>>: UnsafeUnpin,
*const LeafNode<RecordId, i64> is !null: UnsafeUnpin,
PhantomData<Box<(RecordId, i64)>>: UnsafeUnpin,
*const LeafNode<RecordId, InviteState> is !null: UnsafeUnpin,
PhantomData<Box<(RecordId, InviteState)>>: UnsafeUnpin,
PhantomData<JoinRequest>: UnsafeUnpin,
PhantomData<AuditEntry>: UnsafeUnpin,
PhantomData<AuditDeletion>: UnsafeUnpin,
PhantomData<Handover>: UnsafeUnpin,
impl UnwindSafe for Sessionwhere
RawVecInner: UnwindSafe,
BTreeMap<RoleId, RoleSpec>: UnwindSafe,
BTreeMap<Permission, Gate>: UnwindSafe,
BTreeMap<UserId, Member>: UnwindSafe,
BTreeMap<UserId, SetValZST>: UnwindSafe,
BTreeMap<RecordId, Revocation>: UnwindSafe,
BTreeMap<RecordId, i64>: UnwindSafe,
BTreeMap<RecordId, InviteState>: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.