use re_chunk::EntityPath;
#[derive(Debug, Clone)]
pub struct Hdf5Config {
pub index_column: Option<IndexColumn>,
pub ignore_datasets: Vec<String>,
pub use_structs: bool,
pub entity_path_prefix: EntityPath,
}
impl Default for Hdf5Config {
fn default() -> Self {
Self {
index_column: None,
ignore_datasets: Vec::new(),
use_structs: true,
entity_path_prefix: EntityPath::from("/"),
}
}
}
#[derive(Debug, Clone)]
pub struct IndexColumn {
pub path: String,
pub index_type: IndexType,
}
#[derive(Debug, Clone, Copy)]
pub enum IndexType {
Timestamp(TimeUnit),
Duration(TimeUnit),
Sequence,
}
impl IndexType {
pub(crate) fn ns_multiplier(self) -> i64 {
match self {
Self::Timestamp(unit) | Self::Duration(unit) => unit.ns_multiplier(),
Self::Sequence => 1,
}
}
}
#[derive(Debug, Clone, Copy, Default)]
pub enum TimeUnit {
#[default]
Nanoseconds,
Microseconds,
Milliseconds,
Seconds,
}
impl TimeUnit {
pub fn ns_multiplier(self) -> i64 {
match self {
Self::Nanoseconds => 1,
Self::Microseconds => 1_000,
Self::Milliseconds => 1_000_000,
Self::Seconds => 1_000_000_000,
}
}
}