pub struct CRWriter {
pub file: File,
pub file_path: String,
pub pkts_per_file: usize,
pub mbytes_per_file: usize,
pub file_name: String,
pub run_id: u32,
pub file_timestamp: Option<String>,
pub first_gcu_timestamp: Option<u64>,
pub file_len_gcu_sec: Option<u32>,
/* private fields */
}Expand description
Write CRFrames (“caraspace frames”) to disk.
A frame can hold any TOF/TelemetryPacket. Data are written to disk in sequential matter, where frames can be added one at a time and buffered for efficient writing
How to create a new CRWriter (python)
§Arguments
- file_path (str) : Path to store the file under
- run_id (u32) : Run ID for this file (will be written in filename)
- subrun_id (u32) : Sub-Run ID for this file (will be written in filename. If None, a generic “0” will be used
- timestamp (str) : The writer will add an automatic timestamp to the current file based on the current time. This option allows to overwrite that behaviour
- file_len_gcu_sec (u32) : If not None, this will use the gcu time from added packets as the timestamp in the filename, and will write a new file every given number of seconds
Fields§
§file: File§file_path: Stringlocation to store the file
pkts_per_file: usizeThe maximum number of packets for a single file. Ater this number is reached, a new file is started.
mbytes_per_file: usizeThe maximum number of (Mega)bytes per file. After this a new file is started
file_name: Stringthe name of the current file we are writing to
run_id: u32§file_timestamp: Option<String>it can also take a timestamp, in case we don’t want to use the current time when the file is written
first_gcu_timestamp: Option<u64>if writing a new file every gcu seconds, keep the first gcutimestamp
file_len_gcu_sec: Option<u32>Write a new file every gcu seconds (from telemetry packet header)
Implementations§
Source§impl CRWriter
impl CRWriter
Sourcepub fn new(
file_path: String,
run_id: u32,
subrun_id: Option<u64>,
timestamp: Option<String>,
file_len_gcu_sec: Option<u32>,
) -> Self
pub fn new( file_path: String, run_id: u32, subrun_id: Option<u64>, timestamp: Option<String>, file_len_gcu_sec: Option<u32>, ) -> Self
Instantiate a new PacketWriter
§Arguments
- file_path : Path to store the file under
- run_id : Run ID for this file (will be written in filename)
- subrun_id : Sub-Run ID for this file (will be written in filename. If None, a generic “0” will be used
- timestamp : The writer will add an automatic timestamp to the current file based on the current time. This option allows to overwrite that behaviour
- file_len_gcu_sec : If not None, this will use the gcu time from added packets as the timestamp in the filename, and will write a new file every given number of seconds
pub fn get_file(&self, timestamp: Option<String>) -> File ⓘ
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CRWriter
impl RefUnwindSafe for CRWriter
impl Send for CRWriter
impl Sync for CRWriter
impl Unpin for CRWriter
impl UnsafeUnpin for CRWriter
impl UnwindSafe for CRWriter
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>, which can then be
downcast into Box<dyn 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>, which 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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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> ⓘ
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> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.