pub struct Node { /* private fields */ }Implementations§
Source§impl Node
impl Node
Sourcepub async fn insert_edge_connection_middleware<M>(&self, middleware: M)
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.
Sourcepub async fn get_edge_connection_handler(&self) -> EdgeConnectionHandlerObject
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.
Sourcepub async fn set_edge_connection_handler(
&self,
handler: EdgeConnectionHandlerObject,
)
pub async fn set_edge_connection_handler( &self, handler: EdgeConnectionHandlerObject, )
Set the edge connection handler.
Source§impl Node
impl Node
Sourcepub async fn raft(&self) -> Raft<TypeConfig>
pub async fn raft(&self) -> Raft<TypeConfig>
Get the inner openraft structure
Sourcepub fn config(&self) -> &NodeConfig
pub fn config(&self) -> &NodeConfig
Get node config
Sourcepub fn new(config: NodeConfig) -> Self
pub fn new(config: NodeConfig) -> Self
Create a new node
Sourcepub async fn start<C: ClusterProvider>(
&self,
cluster_provider: C,
) -> Result<(), Error>
pub async fn start<C: ClusterProvider>( &self, cluster_provider: C, ) -> Result<(), Error>
Start running, this will start tcp connection service and node discovery service
Sourcepub async fn load_from_durable_service(&self) -> Result<(), Error>
pub async fn load_from_durable_service(&self) -> Result<(), Error>
load existed topic from durable service
pub fn raft_opt(&self) -> Option<Raft<TypeConfig>>
Sourcepub async fn create_edge_connection<C: EdgeNodeConnection>(
&self,
conn: C,
edge_config: EdgeConfig,
) -> Result<NodeId, EdgeConnectionError>
pub async fn create_edge_connection<C: EdgeNodeConnection>( &self, conn: C, edge_config: EdgeConfig, ) -> Result<NodeId, EdgeConnectionError>
Create a connection to a edge node.
pub fn id(&self) -> NodeId
pub fn is(&self, id: NodeId) -> bool
pub fn get_edge_connection(&self, to: NodeId) -> Option<EdgeConnectionRef>
pub async fn remove_edge_connection(&self, to: NodeId)
pub async fn check_ep_auth( &self, ep: &EndpointAddr, peer: &NodeId, ) -> Result<(), EdgeError>
pub async fn is_leader(&self) -> bool
pub async fn wait_for_leader(&self) -> Result<(), Error>
pub async fn load_topic<C: Into<TopicConfig>>( &self, config: C, queue: Vec<DurableMessage>, ) -> Result<(), Error>
pub async fn create_new_topic<C: Into<TopicConfig>>( &self, config: C, ) -> Result<()>
Sourcepub async fn set_wait_ack(&self, id: MessageId) -> WaitAckHandle ⓘ
pub async fn set_wait_ack(&self, id: MessageId) -> WaitAckHandle ⓘ
Create the wait handle of a specific message
Sourcepub async fn send_message(
&self,
topic: TopicCode,
message: Message,
) -> Result<WaitAckHandle, Error>
pub async fn send_message( &self, topic: TopicCode, message: Message, ) -> Result<WaitAckHandle, Error>
Send a message out, and get a awaitable handle.
pub async fn snapshot_data(&self) -> Result<NodeData, Error>
Trait Implementations§
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> 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