mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-19 06:20:38 +00:00
feat: manual compact api (#1912)
* merge develop * chore: merge develop * fix: some cr commentx * fix: cr comments
This commit is contained in:
@@ -37,7 +37,9 @@ pub use self::engine::{
|
||||
TwcsOptions,
|
||||
};
|
||||
pub use self::metadata::RegionMeta;
|
||||
pub use self::region::{CloseContext, FlushContext, FlushReason, Region, RegionStat, WriteContext};
|
||||
pub use self::region::{
|
||||
CloseContext, CompactContext, FlushContext, FlushReason, Region, RegionStat, WriteContext,
|
||||
};
|
||||
pub use self::requests::{
|
||||
AddColumn, AlterOperation, AlterRequest, GetRequest, ScanRequest, WriteRequest,
|
||||
};
|
||||
|
||||
@@ -86,6 +86,8 @@ pub trait Region: Send + Sync + Clone + std::fmt::Debug + 'static {
|
||||
|
||||
/// Flush memtable of the region to disk.
|
||||
async fn flush(&self, ctx: &FlushContext) -> Result<(), Self::Error>;
|
||||
|
||||
async fn compact(&self, ctx: &CompactContext) -> Result<(), Self::Error>;
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
@@ -132,6 +134,18 @@ impl Default for FlushContext {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct CompactContext {
|
||||
/// Whether to wait the compaction result.
|
||||
pub wait: bool,
|
||||
}
|
||||
|
||||
impl Default for CompactContext {
|
||||
fn default() -> CompactContext {
|
||||
CompactContext { wait: true }
|
||||
}
|
||||
}
|
||||
|
||||
/// Reason of flush operation.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum FlushReason {
|
||||
|
||||
Reference in New Issue
Block a user