store_api::region_engine

Trait RegionEngine

source
pub trait RegionEngine: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn handle_request<'life0, 'async_trait>(
        &'life0 self,
        region_id: RegionId,
        request: RegionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<RegionResponse, BoxedError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn handle_query<'life0, 'async_trait>(
        &'life0 self,
        region_id: RegionId,
        request: ScanRequest,
    ) -> Pin<Box<dyn Future<Output = Result<RegionScannerRef, BoxedError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_metadata<'life0, 'async_trait>(
        &'life0 self,
        region_id: RegionId,
    ) -> Pin<Box<dyn Future<Output = Result<RegionMetadataRef, BoxedError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn region_statistic(&self, region_id: RegionId) -> Option<RegionStatistic>;
    fn stop<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), BoxedError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_region_role(
        &self,
        region_id: RegionId,
        role: RegionRole,
    ) -> Result<(), BoxedError>;
    fn set_region_role_state_gracefully<'life0, 'async_trait>(
        &'life0 self,
        region_id: RegionId,
        region_role_state: SettableRegionRoleState,
    ) -> Pin<Box<dyn Future<Output = Result<SetRegionRoleStateResponse, BoxedError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn role(&self, region_id: RegionId) -> Option<RegionRole>;
    fn as_any(&self) -> &dyn Any;

    // Provided method
    fn handle_batch_open_requests<'life0, 'async_trait>(
        &'life0 self,
        parallelism: usize,
        requests: Vec<(RegionId, RegionOpenRequest)>,
    ) -> Pin<Box<dyn Future<Output = Result<BatchResponses, BoxedError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

source

fn name(&self) -> &str

Name of this engine

source

fn handle_request<'life0, 'async_trait>( &'life0 self, region_id: RegionId, request: RegionRequest, ) -> Pin<Box<dyn Future<Output = Result<RegionResponse, BoxedError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles non-query request to the region. Returns the count of affected rows.

source

fn handle_query<'life0, 'async_trait>( &'life0 self, region_id: RegionId, request: ScanRequest, ) -> Pin<Box<dyn Future<Output = Result<RegionScannerRef, BoxedError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles query and return a scanner that can be used to scan the region concurrently.

source

fn get_metadata<'life0, 'async_trait>( &'life0 self, region_id: RegionId, ) -> Pin<Box<dyn Future<Output = Result<RegionMetadataRef, BoxedError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves region’s metadata.

source

fn region_statistic(&self, region_id: RegionId) -> Option<RegionStatistic>

Retrieves region’s statistic.

source

fn stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), BoxedError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stops the engine

source

fn set_region_role( &self, region_id: RegionId, role: RegionRole, ) -> Result<(), BoxedError>

Sets RegionRole for a region.

The engine checks whether the region is writable before writing to the region. Setting the region as readonly doesn’t guarantee that write operations in progress will not take effect.

source

fn set_region_role_state_gracefully<'life0, 'async_trait>( &'life0 self, region_id: RegionId, region_role_state: SettableRegionRoleState, ) -> Pin<Box<dyn Future<Output = Result<SetRegionRoleStateResponse, BoxedError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets region role state gracefully.

After the call returns, the engine ensures no more write operations will succeed in the region.

source

fn role(&self, region_id: RegionId) -> Option<RegionRole>

Indicates region role.

Returns the None if the region is not found.

source

fn as_any(&self) -> &dyn Any

Provided Methods§

source

fn handle_batch_open_requests<'life0, 'async_trait>( &'life0 self, parallelism: usize, requests: Vec<(RegionId, RegionOpenRequest)>, ) -> Pin<Box<dyn Future<Output = Result<BatchResponses, BoxedError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles batch open region requests.

Implementors§