Skip to main content

MeshServerHandler

Struct MeshServerHandler 

Source
pub struct MeshServerHandler {
    pub state: ClusterState,
    pub stores: Arc<StateStores>,
    pub sync_manager: Arc<MeshSyncManager>,
    pub self_name: String,
    /* private fields */
}
Expand description

MeshServerHandler It is the handler for the mesh server, which is responsible for the node management. Includes some basic node management logic, like shutdown, node discovery(TODO), node status update(TODO), etc.

Fields§

§state: ClusterState§stores: Arc<StateStores>§sync_manager: Arc<MeshSyncManager>§self_name: String

Implementations§

Source§

impl MeshServerHandler

Source

pub fn partition_detector(&self) -> Option<&Arc<PartitionDetector>>

Get partition detector

Source

pub fn state_machine(&self) -> Option<&Arc<NodeStateMachine>>

Get state machine

Source

pub fn is_ready(&self) -> bool

Check if node is ready

Source

pub fn should_serve(&self) -> bool

Check if we should serve (have quorum)

Source

pub fn start_rate_limit_task(&self, window_seconds: u64)

Start rate limit window reset task This task will periodically reset the global rate limit counter

Source

pub fn stop_rate_limit_task(&self)

Stop rate limit window reset task

Source

pub fn shutdown(&self)

Shutdown immediately without graceful shutdown

Source

pub async fn graceful_shutdown(&self) -> Result<()>

Graceful shutdown: broadcast LEAVING status to all alive nodes, wait for propagation, then shutdown

Source

pub fn write_data(&self, key: String, value: Vec<u8>) -> Result<()>

Source

pub fn read_data(&self, key: String) -> Option<Vec<u8>>

Source

pub fn get_operation_log(&self) -> OperationLog

Get operation log of the app store for synchronization Returns an operation log that can be merged into other nodes

Source

pub fn sync_app_from_log(&self, log: &OperationLog)

Sync app store data from an operation log (for testing and manual sync) This will be replaced by automatic sync stream in the future

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> 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, 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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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