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§
sourcefn 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_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.
sourcefn 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 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.
sourcefn 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 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.
sourcefn region_statistic(&self, region_id: RegionId) -> Option<RegionStatistic>
fn region_statistic(&self, region_id: RegionId) -> Option<RegionStatistic>
Retrieves region’s statistic.
sourcefn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), BoxedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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
sourcefn set_region_role(
&self,
region_id: RegionId,
role: RegionRole,
) -> Result<(), BoxedError>
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.
sourcefn 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 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.
sourcefn role(&self, region_id: RegionId) -> Option<RegionRole>
fn role(&self, region_id: RegionId) -> Option<RegionRole>
Indicates region role.
Returns the None
if the region is not found.
fn as_any(&self) -> &dyn Any
Provided Methods§
sourcefn 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,
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.