pub struct PeerRing {
pub did: Did,
pub storage: Box<dyn KvStorageInterface<Entry> + Sync + Send>,
pub cache: Box<dyn KvStorageInterface<Entry> + Sync + Send>,
/* private fields */
}Expand description
Chord routing and replicated-storage state for one network peer.
Fields§
§did: DidThe DID of the current node.
storage: Box<dyn KvStorageInterface<Entry> + Sync + Send>Persistent replicated-entry storage.
cache: Box<dyn KvStorageInterface<Entry> + Sync + Send>Local fetched-entry cache.
Implementations§
Source§impl PeerRing
impl PeerRing
Sourcepub fn new_with_storage(
did: Did,
succ_max: u8,
storage: Box<dyn KvStorageInterface<Entry> + Sync + Send>,
) -> PeerRing
pub fn new_with_storage( did: Did, succ_max: u8, storage: Box<dyn KvStorageInterface<Entry> + Sync + Send>, ) -> PeerRing
Construct a peer ring with caller-provided entry storage.
Sourcepub fn new_with_storage_and_finger_table_size(
did: Did,
succ_max: u8,
storage: Box<dyn KvStorageInterface<Entry> + Sync + Send>,
finger_table_size: usize,
) -> PeerRing
pub fn new_with_storage_and_finger_table_size( did: Did, succ_max: u8, storage: Box<dyn KvStorageInterface<Entry> + Sync + Send>, finger_table_size: usize, ) -> PeerRing
Construct a peer ring with caller-provided storage and finger-table size.
Did is 160-bit. Sizes above DEFAULT_FINGER_TABLE_SIZE are clamped
by FingerTable::new; zero disables finger maintenance.
Sourcepub fn new_with_storage_finger_table_size_and_virtual_nodes(
did: Did,
succ_max: u8,
storage: Box<dyn KvStorageInterface<Entry> + Sync + Send>,
finger_table_size: usize,
virtual_nodes: VirtualNodeConfig,
) -> PeerRing
pub fn new_with_storage_finger_table_size_and_virtual_nodes( did: Did, succ_max: u8, storage: Box<dyn KvStorageInterface<Entry> + Sync + Send>, finger_table_size: usize, virtual_nodes: VirtualNodeConfig, ) -> PeerRing
Construct a peer ring with storage and virtual ownership configuration.
Sourcepub fn lock_successor(&self) -> Result<SuccessorSeq, Error>
👎Deprecated: use PeerRing::successors
pub fn lock_successor(&self) -> Result<SuccessorSeq, Error>
use PeerRing::successors
Return the successor sequence.
Sourcepub fn successors(&self) -> SuccessorSeq
pub fn successors(&self) -> SuccessorSeq
Return the successor sequence.
Source§impl PeerRing
impl PeerRing
Sourcepub fn storage_virtual_nodes_enabled(&self) -> Result<bool, Error>
pub fn storage_virtual_nodes_enabled(&self) -> Result<bool, Error>
Return whether the storage virtual-node registry is enabled.
Sourcepub fn storage_virtual_positions(
&self,
owner: Did,
) -> Result<Vec<VirtualNode>, Error>
pub fn storage_virtual_positions( &self, owner: Did, ) -> Result<Vec<VirtualNode>, Error>
Return virtual storage positions owned by owner.
Trait Implementations§
Source§impl Chord<PeerRingAction> for PeerRing
impl Chord<PeerRingAction> for PeerRing
Source§fn join(&self, did: Did) -> Result<PeerRingAction, Error>
fn join(&self, did: Did) -> Result<PeerRingAction, Error>
did.Source§fn find_successor(&self, did: Did) -> Result<PeerRingAction, Error>
fn find_successor(&self, did: Did) -> Result<PeerRingAction, Error>
Source§fn notify(&self, did: Did) -> Result<Did, Error>
fn notify(&self, did: Did) -> Result<Did, Error>
Source§fn fix_fingers(&self) -> Result<PeerRingAction, Error>
fn fix_fingers(&self) -> Result<PeerRingAction, Error>
Source§impl<const REDUNDANT: u16> ChordStorage<PeerRingAction, REDUNDANT> for PeerRing
impl<const REDUNDANT: u16> ChordStorage<PeerRingAction, REDUNDANT> for PeerRing
Source§fn entry_lookup<'life0, 'async_trait>(
&'life0 self,
entry_key: Did,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
fn entry_lookup<'life0, 'async_trait>(
&'life0 self,
entry_key: Did,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
Entry by its ring key.
Always finds resource by DHT, ignoring the local cache.Source§fn entry_operate<'life0, 'async_trait>(
&'life0 self,
op: EntryOperation,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
fn entry_operate<'life0, 'async_trait>(
&'life0 self,
op: EntryOperation,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
entry if it’s 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§impl ChordStorageRepair<PeerRingAction> for PeerRing
impl ChordStorageRepair<PeerRingAction> for PeerRing
Source§fn republish_local_entries<'life0, 'async_trait>(
&'life0 self,
redundancy: u16,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
fn republish_local_entries<'life0, 'async_trait>(
&'life0 self,
redundancy: u16,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
Source§fn read_repair_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
entry: Entry,
misses: &'life1 [PlacementMiss],
redundancy: u16,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PeerRing: 'async_trait,
fn read_repair_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
entry: Entry,
misses: &'life1 [PlacementMiss],
redundancy: u16,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PeerRing: 'async_trait,
Source§impl ChordStorageSync<PeerRingAction> for PeerRing
impl ChordStorageSync<PeerRingAction> for PeerRing
Source§fn sync_entries_with_successor<'life0, 'async_trait>(
&'life0 self,
new_successor: Did,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
fn sync_entries_with_successor<'life0, 'async_trait>(
&'life0 self,
new_successor: Did,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
When the successor of a node is updated, it needs to check if there are
Entrys that are no longer between current node and new_successor,
and copy them to the new successor.
Source§fn acknowledge_synced_entries<'life0, 'life1, 'async_trait>(
&'life0 self,
acks: &'life1 [SyncedEntryAck],
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PeerRing: 'async_trait,
fn acknowledge_synced_entries<'life0, 'life1, 'async_trait>(
&'life0 self,
acks: &'life1 [SyncedEntryAck],
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PeerRing: 'async_trait,
Source§impl CorrectChord<PeerRingAction> for PeerRing
impl CorrectChord<PeerRingAction> for PeerRing
Source§fn update_successor<'life0, 'async_trait>(
&'life0 self,
did: impl LiveDid + 'async_trait,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
fn update_successor<'life0, 'async_trait>(
&'life0 self,
did: impl LiveDid + 'async_trait,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
Source§fn extend_successor<'life0, 'life1, 'async_trait>(
&'life0 self,
dids: &'life1 [impl LiveDid + 'async_trait],
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PeerRing: 'async_trait,
fn extend_successor<'life0, 'life1, 'async_trait>(
&'life0 self,
dids: &'life1 [impl LiveDid + 'async_trait],
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PeerRing: 'async_trait,
Source§fn join_then_sync<'life0, 'async_trait>(
&'life0 self,
did: impl LiveDid + 'async_trait,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
fn join_then_sync<'life0, 'async_trait>(
&'life0 self,
did: impl LiveDid + 'async_trait,
) -> Pin<Box<dyn Future<Output = Result<PeerRingAction, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PeerRing: 'async_trait,
Source§fn pre_stabilize(&self) -> Result<PeerRingAction, Error>
fn pre_stabilize(&self) -> Result<PeerRingAction, Error>
Auto Trait Implementations§
impl !Freeze for PeerRing
impl !RefUnwindSafe for PeerRing
impl !UnwindSafe for PeerRing
impl Send for PeerRing
impl Sync for PeerRing
impl Unpin for PeerRing
impl UnsafeUnpin for PeerRing
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.