StoreCursor

Struct StoreCursor 

Source
pub struct StoreCursor { /* private fields */ }
Expand description

For read-only access to a store. Similar to an iterator, but support moving back and forth.

Implementations§

Source§

impl StoreCursor

Source

pub fn new(logger: Logger, path: PathBuf) -> Self

Create a new cursor with uninitialized shard.

Trait Implementations§

Source§

impl Cursor for StoreCursor

Source§

fn advance(&mut self, direction: Direction) -> Result<bool>

Move the cursor to a neighbor position. Return if the cursor is updated. Returning false means there is no more valid position in the given direction, although retrying may succeed. Notice that true means the current position is valid, but underlying sample may still be invalid.

Source§

fn get(&self) -> Option<(SystemTime, DataFrame)>

Get the sample the cursor is currently pointing at. Notice that a store may contain holes due to data corruption etc, and thus returns None. This does not mean samples are depleted. More could be retrieved by advancing further to skip the holes.

Source§

type Offset = StoreOffset

Source§

type Item = (SystemTime, DataFrame)

Source§

fn get_offset(&self) -> StoreOffset

Get offset of the cursor.
Source§

fn set_offset(&mut self, offset: StoreOffset)

Set offset of the cursor.
Source§

fn next(&mut self, direction: Direction) -> Result<Option<Self::Item>>

Move the cursor in the given direction until a valid item is obtained. If no more valid item available, return None and offset unchanged.
Source§

impl KeyedCursor<u64> for StoreCursor

StoreCursor has each cursor position bound to a SystemTime in monotonic order. This allows moving the cursor relative to SystemTime instances.

Source§

fn get_key(&self) -> Option<u64>

Get timestamp of the current pos.

Source§

fn jump_near_key(&mut self, key: &u64, _direction: Direction)

Set the cursor offset near the given timestamp by inferring shard and index offset.

Source§

fn jump_to_key(&mut self, key: &Key, direction: Direction) -> Result<bool>

Move the cursor to the closest valid pos to the given key in the given direction. Return if the key at the final pos satisfies the ordering requirement. For example, for a list of int keys: [3, 7, 8, 12, 19], jumping to key 9 forward moves cursor to index 3 because 12 is the smallest int greater than 9 in the list. Jumping to key 0 reverse moves cursor to index 0 and returns false because no key is smaller than 3.
Source§

fn get_near( &mut self, key: &Key, preferred_direction: Direction, ) -> Result<Option<Self::Item>>

Convenient function to jump to a key and get the closest valid item to the key. Preference is given to the specified direction. Returns None only if there are no keys at all. Read more
Source§

fn get_next( &mut self, key: &Key, direction: Direction, ) -> Result<Option<Self::Item>>

Convenient function to jump to a key and get the closest valid item that is at key or in the given direction of key. Returns None if no such key exists. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> With for T

Source§

fn wrap_with<U, F>(self, f: F) -> U
where F: FnOnce(Self) -> U,

Calls the given closure and return the result. Read more
Source§

fn with<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Calls the given closure on self.
Source§

fn try_with<E, F>(self, f: F) -> Result<Self, E>
where F: FnOnce(&mut Self) -> Result<(), E>,

Calls the given closure on self.
Source§

fn with_if<F>(self, condition: bool, f: F) -> Self
where F: FnOnce(&mut Self),

Calls the given closure if condition == true.
Source§

impl<T> Erased for T