Enum rings_core::dht::PeerRingAction
source · pub enum PeerRingAction {
None,
SomeVNode(VirtualNode),
Some(Did),
RemoteAction(Did, RemoteAction),
MultiActions(Vec<PeerRingAction>),
}Expand description
PeerRing use this to describe the result of Chord algorithm. Sometimes it’s a
direct result, sometimes it’s an action that is continued externally.
Variants§
None
No result, the whole manipulation is done internally.
SomeVNode(VirtualNode)
Found some VirtualNode.
Some(Did)
Found some node.
RemoteAction(Did, RemoteAction)
Trigger a remote action.
MultiActions(Vec<PeerRingAction>)
Trigger multiple remote actions.
Implementations§
source§impl PeerRingAction
impl PeerRingAction
sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
Returns true if the action is a PeerRingAction::None value.
sourcepub fn is_some(&self) -> bool
pub fn is_some(&self) -> bool
Returns true if the action is a PeerRingAction::Some value.
sourcepub fn is_some_vnode(&self) -> bool
pub fn is_some_vnode(&self) -> bool
Returns true if the action is a PeerRingAction::SomeVNode value.
sourcepub fn is_remote(&self) -> bool
pub fn is_remote(&self) -> bool
Returns true if the action is a PeerRingAction::RemoteAction value.
sourcepub fn is_multi(&self) -> bool
pub fn is_multi(&self) -> bool
Returns true if the action is a PeerRingAction::MultiActions value.
Trait Implementations§
source§impl Chord<PeerRingAction> for PeerRing
impl Chord<PeerRingAction> for PeerRing
source§fn join(&self, did: Did) -> Result<PeerRingAction>
fn join(&self, did: Did) -> Result<PeerRingAction>
Join a ring containing a node identified by did.
This method is usually invoked to maintain successor sequence and finger table
after connect to another node.
This method will return a RemoteAction::FindSuccessorForConnect to the caller.
The caller will send it to the node identified by did, and let the node find
the successor of current node and make current node connect to that successor.
source§fn find_successor(&self, did: Did) -> Result<PeerRingAction>
fn find_successor(&self, did: Did) -> Result<PeerRingAction>
Find the successor of a Did. May return a remote action for the successor is recorded in another node.
source§fn notify(&self, did: Did) -> Result<Did>
fn notify(&self, did: Did) -> Result<Did>
Handle notification from a node that thinks a did is the predecessor of current node.
The did in parameters is the Did of that predecessor.
If that node is closer to current node or current node has no predecessor, set it to the did.
This method will return current predecessor after setting.
source§fn fix_fingers(&self) -> Result<PeerRingAction>
fn fix_fingers(&self) -> Result<PeerRingAction>
Fix finger table by finding the successor for each finger. According to the paper, this method should be called periodically. According to the paper, only one finger should be fixed at a time.
source§impl<const REDUNDANT: u16> ChordStorage<PeerRingAction, REDUNDANT> for PeerRing
impl<const REDUNDANT: u16> ChordStorage<PeerRingAction, REDUNDANT> for PeerRing
source§fn vnode_lookup<'life0, 'async_trait>(
&'life0 self,
vid: Did
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn vnode_lookup<'life0, 'async_trait>(
&'life0 self,
vid: Did
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Look up a VirtualNode by its Did.
Always finds resource by finger table, ignoring the local cache.
If the vid is between current node and its successor, its resource should be
stored in current node.
source§fn vnode_operate<'life0, 'async_trait>(
&'life0 self,
op: VNodeOperation
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn vnode_operate<'life0, 'async_trait>(
&'life0 self,
op: VNodeOperation
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle VNodeOperation if the target vnode between current node and the successor of current node, otherwise find the responsible node and return as Action.
source§impl ChordStorageCache<PeerRingAction> for PeerRing
impl ChordStorageCache<PeerRingAction> for PeerRing
source§fn local_cache_put<'life0, 'async_trait>(
&'life0 self,
vnode: VirtualNode
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn local_cache_put<'life0, 'async_trait>(
&'life0 self,
vnode: VirtualNode
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cache fetched vnode locally.
source§impl ChordStorageSync<PeerRingAction> for PeerRing
impl ChordStorageSync<PeerRingAction> for PeerRing
source§fn sync_vnode_with_successor<'life0, 'async_trait>(
&'life0 self,
new_successor: Did
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn sync_vnode_with_successor<'life0, 'async_trait>(
&'life0 self,
new_successor: Did
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
When the successor of a node is updated, it needs to check if there are
VirtualNodes that are no longer between current node and new_successor,
and sync them to the new successor.
source§impl Clone for PeerRingAction
impl Clone for PeerRingAction
source§fn clone(&self) -> PeerRingAction
fn clone(&self) -> PeerRingAction
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl CorrectChord<PeerRingAction> for PeerRing
impl CorrectChord<PeerRingAction> for PeerRing
source§fn update_successor<'life0, 'async_trait>(
&'life0 self,
did: impl 'async_trait + LiveDid
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_successor<'life0, 'async_trait>(
&'life0 self,
did: impl 'async_trait + LiveDid
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
When Chord have a new successor, ask the new successor for successor list
source§fn join_then_sync<'life0, 'async_trait>(
&'life0 self,
did: impl 'async_trait + LiveDid
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn join_then_sync<'life0, 'async_trait>(
&'life0 self,
did: impl 'async_trait + LiveDid
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Join Operation in the paper. Zave’s work differs from the original Chord paper in that it requires a newly joined node to synchronize its successors from remote nodes.
source§fn rectify(&self, pred: Did) -> Result<()>
fn rectify(&self, pred: Did) -> Result<()>
TODO: Please check this function and make sure it is correct. TODO: Please comment this with clear description. Rectify Operation in the paper.
source§fn pre_stabilize(&self) -> Result<PeerRingAction>
fn pre_stabilize(&self) -> Result<PeerRingAction>
Pre-Stabilize Operation: Before stabilizing, the node should query its first successor for TopoInfo. If there are no successors, return PeerRingAction::None.
source§fn stabilize(&self, info: TopoInfo) -> Result<PeerRingAction>
fn stabilize(&self, info: TopoInfo) -> Result<PeerRingAction>
Stabilize Operation: Perform stabilization for the successor list.
source§fn topo_info(&self) -> Result<TopoInfo>
fn topo_info(&self) -> Result<TopoInfo>
A function to provide topological information about the chord.
source§fn extend_successor<'life0, 'life1, 'async_trait>(
&'life0 self,
dids: &'life1 [impl 'async_trait + LiveDid]
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn extend_successor<'life0, 'life1, 'async_trait>(
&'life0 self,
dids: &'life1 [impl 'async_trait + LiveDid]
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
source§impl Debug for PeerRingAction
impl Debug for PeerRingAction
source§impl From<Vec<PeerRingAction>> for PeerRingAction
impl From<Vec<PeerRingAction>> for PeerRingAction
source§fn from(acts: Vec<PeerRingAction>) -> Self
fn from(acts: Vec<PeerRingAction>) -> Self
source§impl PartialEq for PeerRingAction
impl PartialEq for PeerRingAction
source§fn eq(&self, other: &PeerRingAction) -> bool
fn eq(&self, other: &PeerRingAction) -> bool
self and other values to be equal, and is used
by ==.impl StructuralPartialEq for PeerRingAction
Auto Trait Implementations§
impl Freeze for PeerRingAction
impl RefUnwindSafe for PeerRingAction
impl Send for PeerRingAction
impl Sync for PeerRingAction
impl Unpin for PeerRingAction
impl UnwindSafe for PeerRingAction
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
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 more