pub struct Memory { /* private fields */ }Available on crate feature
connect-server only.Expand description
A Store that keeps everything in memory.
Correct, and suitable for a test or a device that re-pairs on every boot. Anything that must survive a power cut needs a real one.
Implementations§
Source§impl Memory
impl Memory
Sourcepub fn add_node(&self, node: NodeDescription, alias: Option<NodeIdAlias>)
pub fn add_node(&self, node: NodeDescription, alias: Option<NodeIdAlias>)
Add one of our own nodes.
Sourcepub fn open_for_pairing(&self, node: NodeId, token: PairingToken)
pub fn open_for_pairing(&self, node: NodeId, token: PairingToken)
Open one of our nodes for pairing, with this token.
What preparePairing does, and what pressing the button on a device does.
Sourcepub fn close_pairing(&self, node: NodeId)
pub fn close_pairing(&self, node: NodeId)
Stop accepting pairings for a node.
Trait Implementations§
Source§impl Store for Memory
impl Store for Memory
Source§fn pairing_token(&self, node: NodeId) -> Option<PairingToken>
fn pairing_token(&self, node: NodeId) -> Option<PairingToken>
The pairing token currently active for one of our nodes, if any. Read more
Source§fn resolve_alias(&self, alias: &NodeIdAlias) -> Option<NodeId>
fn resolve_alias(&self, alias: &NodeIdAlias) -> Option<NodeId>
Which of our nodes an alias names.
Source§fn sole_node(&self) -> Option<NodeId>
fn sole_node(&self) -> Option<NodeId>
Our node, when the endpoint hosts exactly one and the client named none.
Source§fn nodes(&self) -> Vec<(NodeDescription, Option<NodeIdAlias>)>
fn nodes(&self) -> Vec<(NodeDescription, Option<NodeIdAlias>)>
Every node this endpoint hosts, for
GET /v1/nodes.Source§fn pair(&self, paired: PairedNode)
fn pair(&self, paired: PairedNode)
Record a completed pairing.
Source§fn paired(&self, remote: NodeId) -> Option<PairedNode>
fn paired(&self, remote: NodeId) -> Option<PairedNode>
A pairing, by the remote node’s identifier.
Source§fn paired_with(&self, local: NodeId) -> Vec<NodeId>
fn paired_with(&self, local: NodeId) -> Vec<NodeId>
Every remote node one of our own nodes is currently paired with. Read more
Source§fn set_tokens(&self, remote: NodeId, tokens: TokenStore)
fn set_tokens(&self, remote: NodeId, tokens: TokenStore)
Replace a pairing’s tokens after a rotation.
Source§fn node_for_token(&self, token: &AccessToken) -> Option<NodeId>
fn node_for_token(&self, token: &AccessToken) -> Option<NodeId>
Which of our nodes a presented access token belongs to, if any.
Auto Trait Implementations§
impl !Freeze for Memory
impl Forget for Memory
impl RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnsafeUnpin for Memory
impl UnwindSafe for Memory
Blanket Implementations§
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
Mutably borrows from an owned value. Read more