Skip to main content

Cluster

Struct Cluster 

Source
pub struct Cluster { /* private fields */ }
Expand description

进程内多节点 Raft 集群。

Implementations§

Source§

impl Cluster

Source

pub fn spawn(node_ids: &[NodeID]) -> Self

使用默认快速测试选项启动集群。

Source

pub fn spawn_with_options(node_ids: &[NodeID], opts: Options) -> Self

Source

pub fn client(&self) -> Client

Source

pub fn transport(&self) -> Transport

Source

pub fn members(&self) -> HashSet<NodeID>

Source

pub fn options(&self) -> &Options

Source

pub fn stop(&mut self, id: NodeID)

停止节点(模拟崩溃):不再处理消息/请求,传输层视为离线。

Source

pub fn start(&mut self, id: NodeID)

以空 BitCask 日志重新拉起节点(用于成员加入;新路径空库)。

Source

pub fn set_members(&mut self, members: HashSet<NodeID>)

仅更新本地成员集合视图(协议提交成员变更后由测试调用)。

Source

pub fn partition(&self, a: NodeID, b: NodeID)

Source

pub fn partition_groups(&self, left: &[NodeID], right: &[NodeID])

Source

pub fn heal_all(&self)

Source

pub fn set_drop_rate(&self, rate: f64)

Source

pub fn set_reorder(&self, on: bool)

Source

pub fn is_running(&self, id: NodeID) -> bool

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.