Struct raftstore::coprocessor::region_info_accessor::RegionCollector [−][src]
RegionCollector
is the place where we hold all region information we collected, and the
underlying runner of RegionInfoAccessor
. It listens on events sent by the RegionEventListener
and
keeps information of all regions. Role of each region are also tracked.
Fields
regions: HashMap<u64, RegionInfo>
region_ranges: BTreeMap<Vec<u8>, u64>
Implementations
impl RegionCollector
[src][−]
pub fn new() -> Self
[src]
pub fn create_region(&mut self, region: Region, role: StateRole)
[src]
fn update_region(&mut self, region: Region)
[src]
fn handle_create_region(&mut self, region: Region, role: StateRole)
[src]
fn handle_update_region(&mut self, region: Region, role: StateRole)
[src]
fn handle_destroy_region(&mut self, region: Region)
[src]
fn handle_role_change(&mut self, region: Region, new_role: StateRole)
[src]
fn is_region_epoch_stale(
&self,
region_to_check: &Region,
current: &Region
) -> bool
[src][−]
&self,
region_to_check: &Region,
current: &Region
) -> bool
Determines whether region_to_check
’s epoch is stale compared to current
’s epoch
fn check_region_range(
&mut self,
region: &Region,
clear_regions_in_range: bool
) -> bool
[src][−]
&mut self,
region: &Region,
clear_regions_in_range: bool
) -> bool
For all regions whose range overlaps with the given region
or region_id is the same as
region
’s, checks whether the given region
’s epoch is not older than theirs.
Returns false if the given region
is stale, which means, at least one region above has
newer epoch.
If the given region
is not stale, all other regions in the collection that overlaps with
the given region
must be stale. Returns true in this case, and if clear_regions_in_range
is true, those out-of-date regions will be removed from the collection.
pub fn handle_seek_region(
&self,
from_key: Vec<u8>,
callback: SeekRegionCallback
)
[src]
&self,
from_key: Vec<u8>,
callback: SeekRegionCallback
)
pub fn handle_find_region_by_id(
&self,
region_id: u64,
callback: Callback<Option<RegionInfo>>
)
[src]
&self,
region_id: u64,
callback: Callback<Option<RegionInfo>>
)
pub fn handle_get_regions_in_range(
&self,
start_key: Vec<u8>,
end_key: Vec<u8>,
callback: Callback<Vec<Region>>
)
[src]
&self,
start_key: Vec<u8>,
end_key: Vec<u8>,
callback: Callback<Vec<Region>>
)
fn handle_raftstore_event(&mut self, event: RaftStoreEvent)
[src]
Trait Implementations
impl Runnable for RegionCollector
[src][+]
impl RunnableWithTimer for RegionCollector
[src][+]
Auto Trait Implementations
impl RefUnwindSafe for RegionCollector
impl Send for RegionCollector
impl Sync for RegionCollector
impl Unpin for RegionCollector
impl UnwindSafe for RegionCollector
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,
impl<V, W> ConvertFrom<W> for V where
W: ConvertTo<V>,
[src][+]
W: ConvertTo<V>,
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][+]
U: From<T>,
impl<T> Pointable for T
[src][+]
impl<T> Pointable for T
[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> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src][+]
V: MultiLane<T>,