Struct bufkit_data::Archive
source · pub struct Archive { /* private fields */ }Expand description
The archive.
Implementations
sourceimpl Archive
impl Archive
sourcepub fn create_new<T>(root: T) -> Result<Self, BufkitDataErr>where
T: AsRef<Path>,
pub fn create_new<T>(root: T) -> Result<Self, BufkitDataErr>where
T: AsRef<Path>,
Initialize a new archive.
sourcepub fn connect<T>(root: T) -> Result<Self, BufkitDataErr>where
T: AsRef<Path>,
pub fn connect<T>(root: T) -> Result<Self, BufkitDataErr>where
T: AsRef<Path>,
Open an existing archive.
sourcepub fn get_root(&self) -> &Path
pub fn get_root(&self) -> &Path
Retrieve a path to the root. Allows caller to store files in the database.
sourcepub fn get_sites(&self) -> Result<Vec<Site>, BufkitDataErr>
pub fn get_sites(&self) -> Result<Vec<Site>, BufkitDataErr>
Retrieve a list of sites in the archive.
sourcepub fn get_site_info(&self, site_id: &str) -> Result<Site, BufkitDataErr>
pub fn get_site_info(&self, site_id: &str) -> Result<Site, BufkitDataErr>
Retrieve the information about a single site.
sourcepub fn set_site_info(&self, site: &Site) -> Result<(), BufkitDataErr>
pub fn set_site_info(&self, site: &Site) -> Result<(), BufkitDataErr>
Modify a sites values.
sourcepub fn add_site(&self, site: &Site) -> Result<(), BufkitDataErr>
pub fn add_site(&self, site: &Site) -> Result<(), BufkitDataErr>
Add a site to the list of sites.
sourcepub fn site_exists(&self, site_id: &str) -> Result<bool, BufkitDataErr>
pub fn site_exists(&self, site_id: &str) -> Result<bool, BufkitDataErr>
Check if a site already exists
sourcepub fn models_for_site(&self, site_id: &str) -> Result<Vec<Model>, BufkitDataErr>
pub fn models_for_site(&self, site_id: &str) -> Result<Vec<Model>, BufkitDataErr>
Get a list of models in the database for this site.
sourcepub fn add_file(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime,
text_data: &str
) -> Result<(), BufkitDataErr>
pub fn add_file(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime,
text_data: &str
) -> Result<(), BufkitDataErr>
Add a bufkit file to the archive.
sourcepub fn get_file(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime
) -> Result<String, BufkitDataErr>
pub fn get_file(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime
) -> Result<String, BufkitDataErr>
Retrieve a file from the archive.
sourcepub fn get_most_recent_valid_time(
&self,
site_id: &str,
model: Model
) -> Result<NaiveDateTime, BufkitDataErr>
pub fn get_most_recent_valid_time(
&self,
site_id: &str,
model: Model
) -> Result<NaiveDateTime, BufkitDataErr>
Retrieve the model initialization time of the most recent model in the archive.
sourcepub fn get_most_recent_file(
&self,
site_id: &str,
model: Model
) -> Result<String, BufkitDataErr>
pub fn get_most_recent_file(
&self,
site_id: &str,
model: Model
) -> Result<String, BufkitDataErr>
Retrieve the most recent file
sourcepub fn file_name(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime
) -> String
pub fn file_name(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime
) -> String
Get the file name this would have if uncompressed.
sourcepub fn exists(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime
) -> Result<bool, BufkitDataErr>
pub fn exists(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime
) -> Result<bool, BufkitDataErr>
Check to see if a file is present in the archive and it is retrieveable.
sourcepub fn get_init_times(
&self,
site_id: &str,
model: Model
) -> Result<Vec<NaiveDateTime>, BufkitDataErr>
pub fn get_init_times(
&self,
site_id: &str,
model: Model
) -> Result<Vec<NaiveDateTime>, BufkitDataErr>
Get a list of all the available model initialization times for a given site and model.
sourcepub fn get_inventory(
&self,
site_id: &str,
model: Model
) -> Result<Inventory, BufkitDataErr>
pub fn get_inventory(
&self,
site_id: &str,
model: Model
) -> Result<Inventory, BufkitDataErr>
Get an inventory of soundings for a site & model.
sourcepub fn remove_file(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime
) -> Result<(), BufkitDataErr>
pub fn remove_file(
&self,
site_id: &str,
model: Model,
init_time: &NaiveDateTime
) -> Result<(), BufkitDataErr>
Remove a file from the archive.
sourcepub fn clean_index(
&self
) -> Result<(isize, Receiver<(isize, Option<String>)>), BufkitDataErr>
pub fn clean_index(
&self
) -> Result<(isize, Receiver<(isize, Option<String>)>), BufkitDataErr>
Validate files listed in the index are in the archive too, if not remove them from the index.
Returns a Vec of messages about missing files.
sourcepub fn clean_data(
&self
) -> Result<(usize, Receiver<(usize, Option<String>)>), BufkitDataErr>
pub fn clean_data(
&self
) -> Result<(usize, Receiver<(usize, Option<String>)>), BufkitDataErr>
Search for appropriately named files in the data directory and make sure they are in the index. If a file is not appropriately name or if it is a directory, it is deleted.
Returns a Vec of messages about added files.
sourcepub fn compress_index(&self) -> Result<(), BufkitDataErr>
pub fn compress_index(&self) -> Result<(), BufkitDataErr>
Compress the index file. This cleans up and reorganizes the index file.