pub struct History { /* private fields */ }Expand description
The last samples of an outlet, with their numbers.
The samples have the numbers back - len .. back, with no gap. The
owner gives the number of each sample at the push, and the history
removes samples only from the front.
Implementations§
Source§impl History
impl History
Sourcepub fn new(limits: HistoryLimits, srate: f64, next: u64) -> History
pub fn new(limits: HistoryLimits, srate: f64, next: u64) -> History
Build an empty history. The next sample gets the number next.
Sourcepub fn disk_bytes(&self) -> u64
pub fn disk_bytes(&self) -> u64
The bytes stored in disk spool segments now. Zero when disk spooling is off or has not spilled yet.
Sourcepub fn spool_dir(&self) -> Option<PathBuf>
pub fn spool_dir(&self) -> Option<PathBuf>
Path of the active spool directory, if disk spilling has started.
Sourcepub fn oldest(&self) -> u64
pub fn oldest(&self) -> u64
The number of the oldest sample across disk and RAM. With no sample, the number that the next sample gets.
Sourcepub fn push(&mut self, s: Sample)
pub fn push(&mut self, s: Sample)
Add one sample. Its timestamp must be a full timestamp, not the deduced tag.
The history then removes its oldest samples (or spills them to disk
when disk_bytes > 0) until it is in its limits.
Sourcepub fn push_packed(&mut self, s: PackedSample)
pub fn push_packed(&mut self, s: PackedSample)
Add one PackedSample without copying its Arc payload.
Sourcepub fn read(
&self,
from: u64,
until: u64,
max: usize,
out: &mut Vec<Sample>,
) -> Option<(u64, usize)>
pub fn read( &self, from: u64, until: u64, max: usize, out: &mut Vec<Sample>, ) -> Option<(u64, usize)>
Copy at most max samples to the end of out, from the number
from, and below the number until, in order.
until is the first number that a consumer queue holds. The history
also holds the samples from that number, so without the bound a
resend gives a sample twice. docs/extensions.md, resend rule 5.
If from is below the oldest number, the copy starts at the oldest
number. The result is the number of the first copied sample, and the
count of copied samples. With no copied sample, the result is None.
Sourcepub fn read_packed(
&self,
from: u64,
until: u64,
max: usize,
out: &mut Vec<PackedSample>,
) -> Option<(u64, usize)>
pub fn read_packed( &self, from: u64, until: u64, max: usize, out: &mut Vec<PackedSample>, ) -> Option<(u64, usize)>
Share at most max packed samples to the end of out (Arc clone
for RAM samples, or direct read from disk segment), from from and
below until.