|
|
@ -62,7 +62,7 @@ impl BDFWriter {
|
|
|
|
/// the data will be written to the file
|
|
|
|
/// the data will be written to the file
|
|
|
|
pub fn add_data_entry(&mut self, data_entry: DataEntry) -> Result<(), Error> {
|
|
|
|
pub fn add_data_entry(&mut self, data_entry: DataEntry) -> Result<(), Error> {
|
|
|
|
self.data_entries.push(data_entry);
|
|
|
|
self.data_entries.push(data_entry);
|
|
|
|
if self.data_entries.len() >= ENTRIES_PER_CHUNK as usize {
|
|
|
|
if self.data_entries.len() >= self.metadata.entries_per_chunk as usize {
|
|
|
|
self.flush()?;
|
|
|
|
self.flush()?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -102,6 +102,17 @@ impl BDFWriter {
|
|
|
|
pub fn set_compression_level(&mut self, level: u32) {
|
|
|
|
pub fn set_compression_level(&mut self, level: u32) {
|
|
|
|
self.compression_level = level;
|
|
|
|
self.compression_level = level;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Changes the entries per chunk value.
|
|
|
|
|
|
|
|
/// Returns an error if the metadata has already been written.
|
|
|
|
|
|
|
|
pub fn set_entries_per_chunk(&mut self, number: u32) -> Result<(), Error>{
|
|
|
|
|
|
|
|
if self.head_written {
|
|
|
|
|
|
|
|
return Err(Error::new(ErrorKind::Other, "the head has already been written"))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
self.metadata.entries_per_chunk = number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl BDFReader {
|
|
|
|
impl BDFReader {
|
|
|
|