pub struct Recorder {
pub frames_written: u64,
pub decode_errors: u64,
/* private fields */
}Expand description
An active recording of one device’s CSI stream to a Parquet file.
Decodes each incoming frame against the device’s chip layout and appends it
to the sink. Lives outside crate::state::AppState (which is Clone)
because the underlying file writer is not cloneable.
Fields§
§frames_written: u64Frames successfully decoded and written.
decode_errors: u64Frames that failed to decode (wire drift, truncation, wrong chip).
Implementations§
Source§impl Recorder
impl Recorder
Sourcepub fn start(
path: &str,
chip: &str,
profile: Arc<dyn ClientProfile>,
) -> Result<Self, String>
pub fn start( path: &str, chip: &str, profile: Arc<dyn ClientProfile>, ) -> Result<Self, String>
Open a Parquet file at path for a stream from the given chip string.
profile labels the data_format column from the numeric
cur_bb_format where it can (see ClientProfile::label_format).
Returns Err if the chip is unrecognized (no known wire layout) or the
file cannot be created.
Sourcepub fn record_frame(
&mut self,
bytes: &[u8],
host_rx_micros: i64,
) -> Result<(), ParquetSinkError>
pub fn record_frame( &mut self, bytes: &[u8], host_rx_micros: i64, ) -> Result<(), ParquetSinkError>
Decode one raw WebSocket frame and append it, stamped with host_rx_micros
(UTC microseconds). Decode failures are counted, not propagated, so a
single malformed frame never aborts a recording.
Sourcepub fn finish(self) -> Result<(), ParquetSinkError>
pub fn finish(self) -> Result<(), ParquetSinkError>
Flush remaining rows and finalize the Parquet footer.
Auto Trait Implementations§
impl !RefUnwindSafe for Recorder
impl !Send for Recorder
impl !Sync for Recorder
impl !UnwindSafe for Recorder
impl Freeze for Recorder
impl Unpin for Recorder
impl UnsafeUnpin for Recorder
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.