Skip to main content

NodeServer

Struct NodeServer 

Source
pub struct NodeServer { /* private fields */ }

Implementations§

Source§

impl NodeServer

Source

pub fn new(node: Node, config: Config) -> Self

Source

pub fn get_successor(&self) -> Node

Source

pub fn get_successor_list(&self) -> Vec<Node>

Source

pub fn set_successor_list(&self, succ_list: Vec<Node>)

Source

pub fn get_predecessor(&self) -> Option<Node>

Source

pub fn set_predecessor(&self, node: Option<Node>)

Source

pub async fn start( &mut self, join_node: Option<Node>, ) -> DhtResult<ServerManager>

Start the server Returns if the listener starts

Source

pub fn finger_table_start(&self, k: usize) -> u64

Source

pub fn remove_connection(&self, node: &Node)

Remove broken connections

Source

pub async fn join(&mut self, node: &Node) -> DhtResult<()>

Source

pub async fn stabilize(&mut self)

Source

pub async fn fix_finger(&mut self, index: usize)

Trait Implementations§

Source§

impl Clone for NodeServer

Source§

fn clone(&self) -> NodeServer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl NodeService for NodeServer

Source§

type GetNodeRpcFut = Pin<Box<dyn Future<Output = Node> + Send>>

The response future returned by NodeService::get_node_rpc.
Source§

type GetPredecessorRpcFut = Pin<Box<dyn Future<Output = Option<Node>> + Send>>

The response future returned by NodeService::get_predecessor_rpc.
Source§

type GetSuccessorRpcFut = Pin<Box<dyn Future<Output = Node> + Send>>

The response future returned by NodeService::get_successor_rpc.
Source§

type GetSuccessorListRpcFut = Pin<Box<dyn Future<Output = Vec<Node>> + Send>>

The response future returned by NodeService::get_successor_list_rpc.
Source§

type FindSuccessorListRpcFut = Pin<Box<dyn Future<Output = Vec<Node>> + Send>>

The response future returned by NodeService::find_successor_list_rpc.
Source§

type FindPredecessorRpcFut = Pin<Box<dyn Future<Output = Node> + Send>>

The response future returned by NodeService::find_predecessor_rpc.
Source§

type ClosestPrecedingFingerRpcFut = Pin<Box<dyn Future<Output = Node> + Send>>

The response future returned by NodeService::closest_preceding_finger_rpc.
Source§

type NotifyRpcFut = Pin<Box<dyn Future<Output = ()> + Send>>

The response future returned by NodeService::notify_rpc.
Source§

type StabilizeRpcFut = Pin<Box<dyn Future<Output = ()> + Send>>

The response future returned by NodeService::stabilize_rpc.
Source§

type GetLocalRpcFut = Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send>>

The response future returned by NodeService::get_local_rpc.
Source§

type SetLocalRpcFut = Pin<Box<dyn Future<Output = ()> + Send>>

The response future returned by NodeService::set_local_rpc.
Source§

type GetRpcFut = Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send>>

The response future returned by NodeService::get_rpc.
Source§

type SetRpcFut = Pin<Box<dyn Future<Output = ()> + Send>>

The response future returned by NodeService::set_rpc.
Source§

type ReplicateRpcFut = Pin<Box<dyn Future<Output = ()> + Send>>

The response future returned by NodeService::replicate_rpc.
Source§

fn get_node_rpc(self, _: Context) -> Pin<Box<dyn Future<Output = Node> + Send>>

Source§

fn get_predecessor_rpc( self, _: Context, ) -> Pin<Box<dyn Future<Output = Option<Node>> + Send>>

Source§

fn get_successor_rpc( self, _: Context, ) -> Pin<Box<dyn Future<Output = Node> + Send>>

Source§

fn get_successor_list_rpc( self, _: Context, ) -> Pin<Box<dyn Future<Output = Vec<Node>> + Send>>

Source§

fn find_successor_list_rpc( self, _: Context, id: Digest, ) -> Pin<Box<dyn Future<Output = Vec<Node>> + Send>>

Source§

fn find_predecessor_rpc( self, _: Context, id: Digest, ) -> Pin<Box<dyn Future<Output = Node> + Send>>

Source§

fn closest_preceding_finger_rpc( self, _: Context, id: Digest, ) -> Pin<Box<dyn Future<Output = Node> + Send>>

Source§

fn notify_rpc( self, _: Context, node: Node, ) -> Pin<Box<dyn Future<Output = ()> + Send>>

Source§

fn stabilize_rpc(self, _: Context) -> Pin<Box<dyn Future<Output = ()> + Send>>

Source§

fn get_local_rpc( self, _: Context, key: Key, ) -> Pin<Box<dyn Future<Output = Option<Value>> + Send>>

Source§

fn set_local_rpc( self, _: Context, key: Key, value: Option<Value>, ) -> Pin<Box<dyn Future<Output = ()> + Send>>

Source§

fn get_rpc( self, _: Context, key: Key, ) -> Pin<Box<dyn Future<Output = Option<Value>> + Send>>

Source§

fn set_rpc( self, _: Context, key: Key, value: Option<Value>, ) -> Pin<Box<dyn Future<Output = ()> + Send>>

Source§

fn replicate_rpc( self, _: Context, key: Key, value: Option<Value>, ) -> Pin<Box<dyn Future<Output = ()> + Send>>

Source§

fn serve(self) -> ServeNodeService<Self>

Returns a serving function to use with InFlightRequest::execute.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more