Skip to main content

Node

Struct Node 

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

Implementations§

Source§

impl Node

Source

pub async fn insert_edge_connection_middleware<M>(&self, middleware: M)

Insert a middleware to the edge connection handler.

Middlewares may be used to intercept and modify the behavior of the edge connection handler, such as logging, authentication, etc.

Refer to the EdgeConnectionMiddleware trait for more information.

Source

pub async fn get_edge_connection_handler(&self) -> EdgeConnectionHandlerObject

Get the current edge connection handler.

You may access the Node::edge_handler field directly to get the lock.

Source

pub async fn set_edge_connection_handler( &self, handler: EdgeConnectionHandlerObject, )

Set the edge connection handler.

Source§

impl Node

Source

pub async fn raft(&self) -> Raft<TypeConfig>

Get the inner openraft structure

Source

pub fn config(&self) -> &NodeConfig

Get node config

Source

pub fn new(config: NodeConfig) -> Self

Create a new node

Source

pub async fn start<C: ClusterProvider>( &self, cluster_provider: C, ) -> Result<(), Error>

Start running, this will start tcp connection service and node discovery service

Source

pub async fn load_from_durable_service(&self) -> Result<(), Error>

load existed topic from durable service

Source

pub fn raft_opt(&self) -> Option<Raft<TypeConfig>>

Source

pub fn node_ref(&self) -> NodeRef

Get a weak reference of this node

Source

pub async fn create_edge_connection<C: EdgeNodeConnection>( &self, conn: C, edge_config: EdgeConfig, ) -> Result<NodeId, EdgeConnectionError>

Create a connection to a edge node.

Source

pub fn id(&self) -> NodeId

Source

pub fn is(&self, id: NodeId) -> bool

Source

pub fn get_edge_connection(&self, to: NodeId) -> Option<EdgeConnectionRef>

Source

pub async fn remove_edge_connection(&self, to: NodeId)

Source

pub async fn check_ep_auth( &self, ep: &EndpointAddr, peer: &NodeId, ) -> Result<(), EdgeError>

Source

pub async fn is_leader(&self) -> bool

Source

pub async fn wait_for_leader(&self) -> Result<(), Error>

Source

pub async fn load_topic<C: Into<TopicConfig>>( &self, config: C, queue: Vec<DurableMessage>, ) -> Result<(), Error>

Source

pub async fn create_new_topic<C: Into<TopicConfig>>( &self, config: C, ) -> Result<()>

Source

pub async fn set_wait_ack(&self, id: MessageId) -> WaitAckHandle

Create the wait handle of a specific message

Source

pub async fn send_message( &self, topic: TopicCode, message: Message, ) -> Result<WaitAckHandle, Error>

Send a message out, and get a awaitable handle.

Source

pub async fn snapshot_data(&self) -> Result<NodeData, Error>

Methods from Deref<Target = NodeInner>§

Source

pub async fn shutdown(&self)

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

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 Debug for Node

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Node

Source§

type Target = NodeInner

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Node

§

impl !UnwindSafe for Node

§

impl Freeze for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> 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> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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
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