docs: Add some documentation and TODO comments

pull/24376/head
Carol (Nichols || Goulding) 2020-03-27 09:14:09 -04:00
parent fa8f04ddb3
commit 48954424e1
2 changed files with 8 additions and 0 deletions

View File

@ -259,6 +259,8 @@ impl MemDB {
}
};
// TODO: Encode in the type system that `ReadBatch`es will never be created with an
// empty vector, as we're doing here.
if values.is_empty() {
continue;
}

View File

@ -275,6 +275,7 @@ impl Stream for ReadMergeStream<'_> {
}
}
// TODO: Make a constructor function that fails if given an empty `Vec` of `ReadPoint`s.
#[derive(Debug, PartialEq, Clone)]
pub enum ReadValues {
I64(Vec<ReadPoint<i64>>),
@ -297,6 +298,11 @@ pub struct ReadBatch {
}
impl ReadBatch {
/// Returns the first time and the last time in the batch.
///
/// # Panics
///
/// Will panic if there are no values in the `ReadValues`.
fn start_stop_times(&self) -> (i64, i64) {
match &self.values {
ReadValues::I64(vals) => (vals.first().unwrap().time, vals.last().unwrap().time),