pub trait PushCursor<K, V, T, R>{
// Required methods
fn key(&self) -> Result<Option<&K>, Pending>;
fn val(&self) -> Result<Option<&V>, Pending>;
fn map_times(&mut self, logic: &mut dyn FnMut(&T, &R));
fn weight(&mut self) -> &R
where T: PartialEq<()>;
fn step_key(&mut self);
fn step_val(&mut self);
fn run(&mut self);
}Expand description
Cursor for non-blocking I/O.
Other implementations of cursors do not have a notion of whether data is in
memory, which means that operations to retrieve data can block on I/O. A
PushCursor on the other hand, reports Pending if the data currently to
be retrieved is not yet available because of pending I/O. This allows
merging using such a cursor to be more efficient.
PushCursor is optimized for reading all of the data in a batch.
Required Methods§
Sourcefn key(&self) -> Result<Option<&K>, Pending>
fn key(&self) -> Result<Option<&K>, Pending>
Returns the current key as Ok(Some(key)), or Ok(None) if the batch
is exhausted, or Err(Pending) if this key exists but isn’t available
yet.
Sourcefn val(&self) -> Result<Option<&V>, Pending>
fn val(&self) -> Result<Option<&V>, Pending>
Returns the current value as Ok(Some(key)), or Ok(None) if the key’s
values are exhausted, or Err(Pending) if this value exists but isn’t
available yet.
It is an error if the batch is exhausted or the current key is not available. The implementation might panic or return an incorrect value in this case (but it is not undefined behavior).
Sourcefn map_times(&mut self, logic: &mut dyn FnMut(&T, &R))
fn map_times(&mut self, logic: &mut dyn FnMut(&T, &R))
Applies logic to each pair of time and difference for the current
key-value pair.
When a key-value pair is available, all its time-diff pairs are available.
It is an error if the current key and value are not available. The
implementation might panic or pass incorrect time-diff pairs to logic
in this case (but it is not undefined behavior).
Sourcefn weight(&mut self) -> &R
fn weight(&mut self) -> &R
Returns the weight associated with the current key/value pair.
When a key-value pair is available, its weight is available.
It is an error if the current key and value are not available. The
implementation might panic or pass incorrect time-diff pairs to logic
in this case (but it is not undefined behavior).
Sourcefn step_key(&mut self)
fn step_key(&mut self)
Advances to the next key.
It is an error if the batch is exhausted or the current key is not available. The implementation might panic in this case (but it is not undefined behavior).