Struct test_raftstore::Cluster[][src]

pub struct Cluster<T: Simulator> {
    pub cfg: TiKvConfig,
    leaders: HashMap<u64, Peer>,
    count: usize,
    pub paths: Vec<TempDir>,
    pub dbs: Vec<Engines<RocksEngine, RocksEngine>>,
    pub store_metas: HashMap<u64, Arc<Mutex<StoreMeta>>>,
    key_managers: Vec<Option<Arc<DataKeyManager>>>,
    pub io_rate_limiter: Option<Arc<IORateLimiter>>,
    pub engines: HashMap<u64, Engines<RocksEngine, RocksEngine>>,
    key_managers_map: HashMap<u64, Option<Arc<DataKeyManager>>>,
    pub labels: HashMap<u64, HashMap<String, String>>,
    pub sim: Arc<RwLock<T>>,
    pub pd_client: Arc<TestPdClient>,
}

Fields

cfg: TiKvConfigleaders: HashMap<u64, Peer>count: usizepaths: Vec<TempDir>dbs: Vec<Engines<RocksEngine, RocksEngine>>store_metas: HashMap<u64, Arc<Mutex<StoreMeta>>>key_managers: Vec<Option<Arc<DataKeyManager>>>io_rate_limiter: Option<Arc<IORateLimiter>>engines: HashMap<u64, Engines<RocksEngine, RocksEngine>>key_managers_map: HashMap<u64, Option<Arc<DataKeyManager>>>labels: HashMap<u64, HashMap<String, String>>sim: Arc<RwLock<T>>pd_client: Arc<TestPdClient>

Implementations

impl<T: Simulator> Cluster<T>[src]

pub fn new(
    id: u64,
    count: usize,
    sim: Arc<RwLock<T>>,
    pd_client: Arc<TestPdClient>
) -> Cluster<T>
[src]

pub fn take_path(&mut self) -> Vec<TempDir>[src]

pub fn id(&self) -> u64[src]

pub fn pre_start_check(&mut self) -> Result<(), Box<dyn StdError>>[src]

pub fn set_bootstrapped(&mut self, node_id: u64, offset: usize)[src]

Engines in a just created cluster are not bootstraped, which means they are not associated with a node_id. Call Cluster::start can bootstrap all nodes in the cluster.

However sometimes a node can be bootstrapped externally. This function can be called to mark them as bootstrapped in Cluster.

fn create_engine(
    &mut self,
    router: Option<RaftRouter<RocksEngine, RocksEngine>>
)
[src]

pub fn create_engines(&mut self)[src]

pub fn start(&mut self) -> ServerResult<()>[src]

pub fn compact_data(&self)[src]

pub fn flush_data(&self)[src]

pub fn run(&mut self)[src]

pub fn run_conf_change(&mut self) -> u64[src]

pub fn get_node_ids(&self) -> HashSet<u64>[src]

pub fn run_node(&mut self, node_id: u64) -> ServerResult<()>[src]

pub fn stop_node(&mut self, node_id: u64)[src]

pub fn get_engine(&self, node_id: u64) -> Arc<DB>[src]

pub fn get_raft_engine(&self, node_id: u64) -> Arc<DB>[src]

pub fn get_all_engines(&self, node_id: u64) -> Engines<RocksEngine, RocksEngine>[src]

pub fn send_raft_msg(&mut self, msg: RaftMessage) -> Result<()>[src]

pub fn call_command_on_node(
    &self,
    node_id: u64,
    request: RaftCmdRequest,
    timeout: Duration
) -> Result<RaftCmdResponse>
[src]

pub fn read(
    &self,
    batch_id: Option<ThreadReadId>,
    request: RaftCmdRequest,
    timeout: Duration
) -> Result<RaftCmdResponse>
[src]

pub fn call_command(
    &self,
    request: RaftCmdRequest,
    timeout: Duration
) -> Result<RaftCmdResponse>
[src]

pub fn call_command_on_leader(
    &mut self,
    request: RaftCmdRequest,
    timeout: Duration
) -> Result<RaftCmdResponse>
[src]

fn valid_leader_id(&self, region_id: u64, leader_id: u64) -> bool[src]

fn store_ids_of_region(&self, region_id: u64) -> Option<Vec<u64>>[src]

pub fn query_leader(
    &self,
    store_id: u64,
    region_id: u64,
    timeout: Duration
) -> Option<Peer>
[src]

pub fn leader_of_region(&mut self, region_id: u64) -> Option<Peer>[src]

pub fn check_regions_number(&self, len: u32)[src]

pub fn add_first_region(&self) -> Result<()>[src]

pub fn bootstrap_region(&mut self) -> Result<()>[src]

Multiple nodes with fixed node id, like node 1, 2, .. 5, First region 1 is in all stores with peer 1, 2, .. 5. Peer 1 is in node 1, store 1, etc.

Must be called after create_engines.

pub fn bootstrap_conf_change(&mut self) -> u64[src]

fn bootstrap_cluster(&mut self, region: Region)[src]

pub fn add_label(&mut self, node_id: u64, key: &str, value: &str)[src]

pub fn add_new_engine(&mut self) -> u64[src]

pub fn reset_leader_of_region(&mut self, region_id: u64)[src]

pub fn assert_quorum<F: FnMut(&Arc<DB>) -> bool>(&self, condition: F)[src]

pub fn shutdown(&mut self)[src]

fn refresh_leader_if_needed(
    &mut self,
    resp: &RaftCmdResponse,
    region_id: u64
) -> bool
[src]

pub fn request(
    &mut self,
    key: &[u8],
    reqs: Vec<Request>,
    read_quorum: bool,
    timeout: Duration
) -> RaftCmdResponse
[src]

pub fn get_region_with<F>(&self, key: &[u8], filter: F) -> Region where
    F: Fn(&Region) -> bool
[src]

pub fn get_region(&self, key: &[u8]) -> Region[src]

pub fn get_region_id(&self, key: &[u8]) -> u64[src]

pub fn get_down_peers(&self) -> HashMap<u64, PeerStats>[src]

pub fn get(&mut self, key: &[u8]) -> Option<Vec<u8>>[src]

pub fn get_cf(&mut self, cf: &str, key: &[u8]) -> Option<Vec<u8>>[src]

pub fn must_get(&mut self, key: &[u8]) -> Option<Vec<u8>>[src]

fn get_impl(
    &mut self,
    cf: &str,
    key: &[u8],
    read_quorum: bool
) -> Option<Vec<u8>>
[src]

pub fn async_request(
    &mut self,
    req: RaftCmdRequest
) -> Result<Receiver<RaftCmdResponse>>
[src]

pub fn async_exit_joint(
    &mut self,
    region_id: u64
) -> Result<Receiver<RaftCmdResponse>>
[src]

pub fn async_put(
    &mut self,
    key: &[u8],
    value: &[u8]
) -> Result<Receiver<RaftCmdResponse>>
[src]

pub fn async_remove_peer(
    &mut self,
    region_id: u64,
    peer: Peer
) -> Result<Receiver<RaftCmdResponse>>
[src]

pub fn async_add_peer(
    &mut self,
    region_id: u64,
    peer: Peer
) -> Result<Receiver<RaftCmdResponse>>
[src]

pub fn must_put(&mut self, key: &[u8], value: &[u8])[src]

pub fn must_put_cf(&mut self, cf: &str, key: &[u8], value: &[u8])[src]

pub fn put(&mut self, key: &[u8], value: &[u8]) -> Result<(), PbError>[src]

pub fn must_delete(&mut self, key: &[u8])[src]

pub fn must_delete_cf(&mut self, cf: &str, key: &[u8])[src]

pub fn must_delete_range_cf(&mut self, cf: &str, start: &[u8], end: &[u8])[src]

pub fn must_notify_delete_range_cf(
    &mut self,
    cf: &str,
    start: &[u8],
    end: &[u8]
)
[src]

pub fn must_flush_cf(&mut self, cf: &str, sync: bool)[src]

pub fn get_region_epoch(&self, region_id: u64) -> RegionEpoch[src]

pub fn region_detail(
    &self,
    region_id: u64,
    store_id: u64
) -> RegionDetailResponse
[src]

pub fn truncated_state(
    &self,
    region_id: u64,
    store_id: u64
) -> RaftTruncatedState
[src]

pub fn wait_log_truncated(&self, region_id: u64, store_id: u64, index: u64)[src]

pub fn apply_state(&self, region_id: u64, store_id: u64) -> RaftApplyState[src]

pub fn raft_local_state(&self, region_id: u64, store_id: u64) -> RaftLocalState[src]

pub fn region_local_state(
    &self,
    region_id: u64,
    store_id: u64
) -> RegionLocalState
[src]

pub fn wait_last_index(
    &mut self,
    region_id: u64,
    store_id: u64,
    expected: u64,
    timeout: Duration
)
[src]

pub fn restore_kv_meta(
    &self,
    region_id: u64,
    store_id: u64,
    snap: &RocksSnapshot
)
[src]

pub fn restore_raft(&self, region_id: u64, store_id: u64, snap: &RocksSnapshot)[src]

pub fn add_send_filter<F: FilterFactory>(&self, factory: F)[src]

pub fn transfer_leader(&mut self, region_id: u64, leader: Peer)[src]

pub fn must_transfer_leader(&mut self, region_id: u64, leader: Peer)[src]

pub fn get_snap_dir(&self, node_id: u64) -> String[src]

pub fn get_snap_mgr(&self, node_id: u64) -> SnapManager[src]

pub fn clear_send_filters(&mut self)[src]

pub fn split_region(
    &mut self,
    region: &Region,
    split_key: &[u8],
    cb: Callback<RocksSnapshot>
)
[src]

pub fn must_split(&mut self, region: &Region, split_key: &[u8])[src]

pub fn wait_region_split(&mut self, region: &Region)[src]

pub fn wait_region_split_max_cnt(
    &mut self,
    region: &Region,
    itvl_ms: u64,
    max_try_cnt: u64,
    is_panic: bool
)
[src]

fn new_prepare_merge(&self, source: u64, target: u64) -> RaftCmdRequest[src]

pub fn merge_region(
    &mut self,
    source: u64,
    target: u64,
    cb: Callback<RocksSnapshot>
)
[src]

pub fn try_merge(&mut self, source: u64, target: u64) -> RaftCmdResponse[src]

pub fn must_try_merge(&mut self, source: u64, target: u64)[src]

pub fn must_region_exist(&mut self, region_id: u64, store_id: u64)[src]

Make sure region exists on that store.

pub fn must_region_not_exist(&mut self, region_id: u64, store_id: u64)[src]

Make sure region not exists on that store.

pub fn must_remove_region(&mut self, store_id: u64, region_id: u64)[src]

pub fn partition(&self, s1: Vec<u64>, s2: Vec<u64>)[src]

pub fn must_request_snapshot(&self, store_id: u64, region_id: u64) -> u64[src]

Trait Implementations

impl<T: Simulator> Drop for Cluster<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Cluster<T>

impl<T> Send for Cluster<T> where
    T: Send + Sync

impl<T> Sync for Cluster<T> where
    T: Send + Sync

impl<T> Unpin for Cluster<T>

impl<T> !UnwindSafe for Cluster<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<V, W> ConvertFrom<W> for V where
    W: ConvertTo<V>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]