Struct test_raftstore::Cluster [−][src]
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]
id: u64,
count: usize,
sim: Arc<RwLock<T>>,
pd_client: Arc<TestPdClient>
) -> Cluster<T>
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]
&mut self,
router: Option<RaftRouter<RocksEngine, RocksEngine>>
)
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]
&self,
node_id: u64,
request: RaftCmdRequest,
timeout: Duration
) -> Result<RaftCmdResponse>
pub fn read(
&self,
batch_id: Option<ThreadReadId>,
request: RaftCmdRequest,
timeout: Duration
) -> Result<RaftCmdResponse>[src]
&self,
batch_id: Option<ThreadReadId>,
request: RaftCmdRequest,
timeout: Duration
) -> Result<RaftCmdResponse>
pub fn call_command(
&self,
request: RaftCmdRequest,
timeout: Duration
) -> Result<RaftCmdResponse>[src]
&self,
request: RaftCmdRequest,
timeout: Duration
) -> Result<RaftCmdResponse>
pub fn call_command_on_leader(
&mut self,
request: RaftCmdRequest,
timeout: Duration
) -> Result<RaftCmdResponse>[src]
&mut self,
request: RaftCmdRequest,
timeout: Duration
) -> Result<RaftCmdResponse>
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]
&self,
store_id: u64,
region_id: u64,
timeout: Duration
) -> Option<Peer>
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]
&mut self,
resp: &RaftCmdResponse,
region_id: u64
) -> bool
pub fn request(
&mut self,
key: &[u8],
reqs: Vec<Request>,
read_quorum: bool,
timeout: Duration
) -> RaftCmdResponse[src]
&mut self,
key: &[u8],
reqs: Vec<Request>,
read_quorum: bool,
timeout: Duration
) -> RaftCmdResponse
pub fn get_region_with<F>(&self, key: &[u8], filter: F) -> Region where
F: Fn(&Region) -> bool, [src]
F: Fn(&Region) -> bool,
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]
&mut self,
cf: &str,
key: &[u8],
read_quorum: bool
) -> Option<Vec<u8>>
pub fn async_request(
&mut self,
req: RaftCmdRequest
) -> Result<Receiver<RaftCmdResponse>>[src]
&mut self,
req: RaftCmdRequest
) -> Result<Receiver<RaftCmdResponse>>
pub fn async_exit_joint(
&mut self,
region_id: u64
) -> Result<Receiver<RaftCmdResponse>>[src]
&mut self,
region_id: u64
) -> Result<Receiver<RaftCmdResponse>>
pub fn async_put(
&mut self,
key: &[u8],
value: &[u8]
) -> Result<Receiver<RaftCmdResponse>>[src]
&mut self,
key: &[u8],
value: &[u8]
) -> Result<Receiver<RaftCmdResponse>>
pub fn async_remove_peer(
&mut self,
region_id: u64,
peer: Peer
) -> Result<Receiver<RaftCmdResponse>>[src]
&mut self,
region_id: u64,
peer: Peer
) -> Result<Receiver<RaftCmdResponse>>
pub fn async_add_peer(
&mut self,
region_id: u64,
peer: Peer
) -> Result<Receiver<RaftCmdResponse>>[src]
&mut self,
region_id: u64,
peer: Peer
) -> Result<Receiver<RaftCmdResponse>>
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]
&mut self,
cf: &str,
start: &[u8],
end: &[u8]
)
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]
&self,
region_id: u64,
store_id: u64
) -> RegionDetailResponse
pub fn truncated_state(
&self,
region_id: u64,
store_id: u64
) -> RaftTruncatedState[src]
&self,
region_id: u64,
store_id: u64
) -> RaftTruncatedState
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]
&self,
region_id: u64,
store_id: u64
) -> RegionLocalState
pub fn wait_last_index(
&mut self,
region_id: u64,
store_id: u64,
expected: u64,
timeout: Duration
)[src]
&mut self,
region_id: u64,
store_id: u64,
expected: u64,
timeout: Duration
)
pub fn restore_kv_meta(
&self,
region_id: u64,
store_id: u64,
snap: &RocksSnapshot
)[src]
&self,
region_id: u64,
store_id: u64,
snap: &RocksSnapshot
)
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]
&mut self,
region: &Region,
split_key: &[u8],
cb: Callback<RocksSnapshot>
)
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]
&mut self,
region: &Region,
itvl_ms: u64,
max_try_cnt: u64,
is_panic: bool
)
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]
&mut self,
source: u64,
target: u64,
cb: Callback<RocksSnapshot>
)
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
Auto Trait Implementations
impl<T> !RefUnwindSafe for Cluster<T>
impl<T> Send for Cluster<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Sync for Cluster<T> where
T: Send + Sync,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<V, W> ConvertFrom<W> for V where
W: ConvertTo<V>, [src]
W: ConvertTo<V>,
pub fn convert_from(ctx: &mut EvalContext, from: W) -> Result<V, Error>[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Pointable for T[src]
pub const ALIGN: usize[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T[src]
pub unsafe fn drop(ptr: usize)[src]
impl<T> Pointable for T[src]
pub const ALIGN: usize[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T[src]
pub unsafe fn drop(ptr: usize)[src]
impl<T> Same<T> for T[src]
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>, [src]
V: MultiLane<T>,