pub struct HistoryCheckpoint {
pub device_id: String,
pub current_param: HistoryParamCheckpoint,
pub resume_index: u16,
pub total_readings: u16,
pub completed_params: Vec<HistoryParamCheckpoint>,
pub created_at: OffsetDateTime,
pub downloaded_data: Option<PartialHistoryData>,
}Expand description
Checkpoint data for resuming interrupted history downloads.
This can be serialized and saved to disk to allow resuming downloads after disconnection or application restart.
Fields§
§device_id: StringDevice identifier this checkpoint belongs to.
current_param: HistoryParamCheckpointThe parameter currently being downloaded.
resume_index: u16Index where download should resume for current parameter.
total_readings: u16Total readings on the device when checkpoint was created.
completed_params: Vec<HistoryParamCheckpoint>Which parameters have been fully downloaded.
created_at: OffsetDateTimeTimestamp when checkpoint was created.
downloaded_data: Option<PartialHistoryData>Downloaded values for completed parameters (serialized).
Implementations§
Source§impl HistoryCheckpoint
impl HistoryCheckpoint
Sourcepub fn new(
device_id: &str,
total_readings: u16,
first_param: HistoryParam,
) -> Self
pub fn new( device_id: &str, total_readings: u16, first_param: HistoryParam, ) -> Self
Create a new checkpoint for starting a fresh download.
Sourcepub fn is_valid(&self, current_total_readings: u16) -> bool
pub fn is_valid(&self, current_total_readings: u16) -> bool
Check if this checkpoint is still valid for the given device state.
Sourcepub fn complete_param(&mut self, param: HistoryParam, values: Vec<u16>)
pub fn complete_param(&mut self, param: HistoryParam, values: Vec<u16>)
Update the checkpoint after completing a parameter.
Sourcepub fn complete_radon_param(&mut self, values: Vec<u32>)
pub fn complete_radon_param(&mut self, values: Vec<u32>)
Update the checkpoint after completing a radon parameter.
Trait Implementations§
Source§impl Clone for HistoryCheckpoint
impl Clone for HistoryCheckpoint
Source§fn clone(&self) -> HistoryCheckpoint
fn clone(&self) -> HistoryCheckpoint
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 HistoryCheckpoint
impl Debug for HistoryCheckpoint
Source§impl<'de> Deserialize<'de> for HistoryCheckpoint
impl<'de> Deserialize<'de> for HistoryCheckpoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HistoryCheckpoint
impl RefUnwindSafe for HistoryCheckpoint
impl Send for HistoryCheckpoint
impl Sync for HistoryCheckpoint
impl Unpin for HistoryCheckpoint
impl UnwindSafe for HistoryCheckpoint
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