Skip to main content

PartCache

Struct PartCache 

Source
pub(crate) struct PartCache<'a> {
    pub(crate) parts: &'a [PartInfo],
    pub(crate) loaded: HashMap<usize, Archive>,
}
Expand description

Loads part files on demand and drops them once no later window needs them.

Fields§

§parts: &'a [PartInfo]

First-pass information for every non-empty part file.

§loaded: HashMap<usize, Archive>

Loaded contents, by index into parts.

Implementations§

Source§

impl<'a> PartCache<'a>

Source

pub(crate) fn new(parts: &'a [PartInfo]) -> Self

Creates an empty cache over parts.

Source

pub(crate) fn window_rows( &mut self, window: i64, rotate_secs: u64, ) -> Result<Vec<(usize, Vec<(usize, i64, u64)>)>>

Returns every row of every part file in window, tagged with its group.

Files are loaded the first time a window needs them and dropped once their last window has been served, so memory holds only the files around the current window.

§Arguments
  • window - Window to collect. Windows must be requested in increasing order.
  • rotate_secs - Window length in seconds.
§Returns

The rows (unsorted, duplicates included) and, per source file, the rows that file contributed, for the independent check.

§Errors

Returns an error if a file cannot be read.

Auto Trait Implementations§

§

impl<'a> Freeze for PartCache<'a>

§

impl<'a> RefUnwindSafe for PartCache<'a>

§

impl<'a> Send for PartCache<'a>

§

impl<'a> Sync for PartCache<'a>

§

impl<'a> Unpin for PartCache<'a>

§

impl<'a> UnsafeUnpin for PartCache<'a>

§

impl<'a> UnwindSafe for PartCache<'a>

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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.