Struct raftstore::coprocessor::region_info_accessor::RegionCollector[][src]

pub struct RegionCollector {
    regions: HashMap<u64, RegionInfo>,
    region_ranges: BTreeMap<Vec<u8>, u64>,
}

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]

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]

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]

pub fn handle_find_region_by_id(
    &self,
    region_id: u64,
    callback: Callback<Option<RegionInfo>>
)
[src]

pub fn handle_get_regions_in_range(
    &self,
    start_key: Vec<u8>,
    end_key: Vec<u8>,
    callback: Callback<Vec<Region>>
)
[src]

fn handle_raftstore_event(&mut self, event: RaftStoreEvent)[src]

Trait Implementations

impl Runnable for RegionCollector[src]

type Task = RegionInfoQuery

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]

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> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?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]