pub struct MemoryStore { /* private fields */ }Expand description
In-memory time-series store (for testing and real-time buffers).
Implementations§
Source§impl MemoryStore
impl MemoryStore
pub fn new() -> Self
Sourcepub fn bulk_insert(
&mut self,
channel: &str,
samples: Vec<Sample>,
) -> Result<(), TsError>
pub fn bulk_insert( &mut self, channel: &str, samples: Vec<Sample>, ) -> Result<(), TsError>
Bulk-insert a pre-built sample vector.
Sourcepub fn at(
&self,
channel: &str,
timestamp: f64,
) -> Result<Option<Sample>, TsError>
pub fn at( &self, channel: &str, timestamp: f64, ) -> Result<Option<Sample>, TsError>
Value at a specific timestamp (exact match, no interpolation).
Sourcepub fn interpolate(&self, channel: &str, timestamp: f64) -> Result<f64, TsError>
pub fn interpolate(&self, channel: &str, timestamp: f64) -> Result<f64, TsError>
Linear interpolation at a specific timestamp.
Sourcepub fn resample_mean(
&self,
channel: &str,
t_start: f64,
t_end: f64,
window_s: f64,
) -> Result<Vec<Sample>, TsError>
pub fn resample_mean( &self, channel: &str, t_start: f64, t_end: f64, window_s: f64, ) -> Result<Vec<Sample>, TsError>
Downsample by taking mean over windows of width window_s.
Trait Implementations§
Source§impl Clone for MemoryStore
impl Clone for MemoryStore
Source§fn clone(&self) -> MemoryStore
fn clone(&self) -> MemoryStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryStore
impl Debug for MemoryStore
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§fn default() -> MemoryStore
fn default() -> MemoryStore
Returns the “default value” for a type. Read more
Source§impl TimeSeriesStore for MemoryStore
impl TimeSeriesStore for MemoryStore
Source§fn create_channel(&mut self, channel: Channel)
fn create_channel(&mut self, channel: Channel)
Create or register a channel.
Source§fn channel_names(&self) -> Vec<String>
fn channel_names(&self) -> Vec<String>
List all channel names.
Source§fn append(
&mut self,
channel: &str,
timestamp: f64,
value: f64,
) -> Result<(), TsError>
fn append( &mut self, channel: &str, timestamp: f64, value: f64, ) -> Result<(), TsError>
Append a single sample.
Source§fn append_with_quality(
&mut self,
channel: &str,
timestamp: f64,
value: f64,
quality: u8,
) -> Result<(), TsError>
fn append_with_quality( &mut self, channel: &str, timestamp: f64, value: f64, quality: u8, ) -> Result<(), TsError>
Append a sample with quality flag.
Source§fn range(
&self,
channel: &str,
t_start: f64,
t_end: f64,
) -> Result<Vec<Sample>, TsError>
fn range( &self, channel: &str, t_start: f64, t_end: f64, ) -> Result<Vec<Sample>, TsError>
Retrieve all samples in [t_start, t_end].
Source§fn latest(&self, channel: &str, n: usize) -> Result<Vec<Sample>, TsError>
fn latest(&self, channel: &str, n: usize) -> Result<Vec<Sample>, TsError>
Retrieve the latest N samples.
Auto Trait Implementations§
impl Freeze for MemoryStore
impl RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin for MemoryStore
impl UnwindSafe for MemoryStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.