Skip to content

Commit

Permalink
engine_traits: Stub out get_range_approximate_middle
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Anderson <andersrb@gmail.com>
  • Loading branch information
brson committed Jul 15, 2020
1 parent af67c35 commit 39e76b2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/engine_panic/src/range_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,13 @@ impl RangePropertiesExt for PanicEngine {
fn get_range_approximate_split_keys_cf(&self, cfname: &str, range: Range, region_id: u64, split_size: u64, max_size: u64, batch_split_limit: u64) -> Result<Vec<Vec<u8>>> {
panic!()
}

fn get_range_approximate_middle(&self, range: Range, region_id: u64) -> Result<Option<Vec<u8>>> {
panic!()
}

fn get_range_approximate_middle_cf(&self, cfname: &str, range: Range, region_id: u64) -> Result<Option<Vec<u8>>> {
panic!()
}

}
9 changes: 9 additions & 0 deletions components/engine_rocks/src/range_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,13 @@ impl RangePropertiesExt for RocksEngine {
}
Ok(split_keys)
}

fn get_range_approximate_middle(&self, range: Range, region_id: u64) -> Result<Option<Vec<u8>>> {
panic!()
}

fn get_range_approximate_middle_cf(&self, cfname: &str, range: Range, region_id: u64) -> Result<Option<Vec<u8>>> {
panic!()
}

}
13 changes: 13 additions & 0 deletions components/engine_traits/src/range_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,18 @@ pub trait RangePropertiesExt {
fn get_range_approximate_split_keys(&self, range: Range, region_id: u64, split_size: u64, max_size: u64, batch_split_limit: u64) -> Result<Vec<Vec<u8>>>;

fn get_range_approximate_split_keys_cf(&self, cfname: &str, range: Range, region_id: u64, split_size: u64, max_size: u64, batch_split_limit: u64) -> Result<Vec<Vec<u8>>>;

/// Get range approximate middle key based on default and write cf size.
///
/// The region_id is used only for logging and means nothing internally.
fn get_range_approximate_middle(&self, range: Range, region_id: u64) -> Result<Option<Vec<u8>>>;

/// Get the approximate middle key of the region. If we suppose the region
/// is stored on disk as a plain file, "middle key" means the key whose
/// position is in the middle of the file.
///
/// The returned key maybe is timestamped if transaction KV is used,
/// and must start with "z".
fn get_range_approximate_middle_cf(&self, cfname: &str, range: Range, region_id: u64) -> Result<Option<Vec<u8>>>;
}

1 change: 1 addition & 0 deletions components/raftstore/src/coprocessor/split_check/half.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ pub fn get_region_approximate_middle(
/// The returned key maybe is timestamped if transaction KV is used,
/// and must start with "z".
fn get_region_approximate_middle_cf(

db: &impl KvEngine,
cfname: &str,
region: &Region,
Expand Down

0 comments on commit 39e76b2

Please sign in to comment.