pub struct Archive { /* private fields */ }
Expand description
The archive.
Implementations§
Source§impl Archive
impl Archive
Sourcepub fn clean(&self) -> Result<(), BufkitDataErr>
pub fn clean(&self) -> Result<(), BufkitDataErr>
Validate files listed in the index are in the archive too, if not remove them from the index.
Source§impl Archive
impl Archive
Sourcepub fn add(
&self,
site_id_hint: &str,
stn_num_hint: Option<StationNumber>,
init_time_hint: Option<NaiveDateTime>,
model: Model,
text_data: &str,
) -> Result<StationNumber, BufkitDataErr>
pub fn add( &self, site_id_hint: &str, stn_num_hint: Option<StationNumber>, init_time_hint: Option<NaiveDateTime>, model: Model, text_data: &str, ) -> Result<StationNumber, BufkitDataErr>
Add a bufkit file to the archive.
Sourcepub fn add_site(&self, site: &SiteInfo) -> Result<(), BufkitDataErr>
pub fn add_site(&self, site: &SiteInfo) -> Result<(), BufkitDataErr>
Add a site to the list of sites.
If a site with this station number already exists, return an error from the underlying database.
Sourcepub fn update_site(&self, site: &SiteInfo) -> Result<(), BufkitDataErr>
pub fn update_site(&self, site: &SiteInfo) -> Result<(), BufkitDataErr>
Modify a site’s values.
Sourcepub fn remove(
&self,
station_num: StationNumber,
model: Model,
init_time: NaiveDateTime,
) -> Result<(), BufkitDataErr>
pub fn remove( &self, station_num: StationNumber, model: Model, init_time: NaiveDateTime, ) -> Result<(), BufkitDataErr>
Remove a file from the archive.
Sourcepub fn remove_site(
&self,
station_num: StationNumber,
) -> Result<(), BufkitDataErr>
pub fn remove_site( &self, station_num: StationNumber, ) -> Result<(), BufkitDataErr>
Remove a site and all of its files from the archive.
Source§impl Archive
impl Archive
Sourcepub fn station_summaries(&self) -> Result<Vec<StationSummary>, BufkitDataErr>
pub fn station_summaries(&self) -> Result<Vec<StationSummary>, BufkitDataErr>
Get a summary of all the stations in the archive.
Source§impl Archive
impl Archive
Sourcepub fn sites(&self) -> Result<Vec<SiteInfo>, BufkitDataErr>
pub fn sites(&self) -> Result<Vec<SiteInfo>, BufkitDataErr>
Retrieve a list of sites in the archive.
Sourcepub fn sites_and_ids_for(
&self,
model: Model,
) -> Result<Vec<(SiteInfo, String)>, BufkitDataErr>
pub fn sites_and_ids_for( &self, model: Model, ) -> Result<Vec<(SiteInfo, String)>, BufkitDataErr>
Retrieve the sites with their most recent station id for the given model.
Sourcepub fn site(&self, station_num: StationNumber) -> Option<SiteInfo>
pub fn site(&self, station_num: StationNumber) -> Option<SiteInfo>
Retrieve the information about a single site id
Sourcepub fn models(
&self,
station_num: StationNumber,
) -> Result<Vec<Model>, BufkitDataErr>
pub fn models( &self, station_num: StationNumber, ) -> Result<Vec<Model>, BufkitDataErr>
Get a list of models in the archive for this site.
Sourcepub fn retrieve(
&self,
station_num: StationNumber,
model: Model,
init_time: NaiveDateTime,
) -> Result<String, BufkitDataErr>
pub fn retrieve( &self, station_num: StationNumber, model: Model, init_time: NaiveDateTime, ) -> Result<String, BufkitDataErr>
Retrieve a file from the archive.
Sourcepub fn retrieve_most_recent(
&self,
station_num: StationNumber,
model: Model,
) -> Result<String, BufkitDataErr>
pub fn retrieve_most_recent( &self, station_num: StationNumber, model: Model, ) -> Result<String, BufkitDataErr>
Retrieve the most recent file.
Sourcepub fn retrieve_all_valid_in(
&self,
station_num: StationNumber,
model: Model,
start: NaiveDateTime,
end: NaiveDateTime,
) -> Result<impl Iterator<Item = String>, BufkitDataErr>
pub fn retrieve_all_valid_in( &self, station_num: StationNumber, model: Model, start: NaiveDateTime, end: NaiveDateTime, ) -> Result<impl Iterator<Item = String>, BufkitDataErr>
Retrieve all the soundings with any data valid between the start and end times.
Sourcepub fn file_exists(
&self,
site: StationNumber,
model: Model,
init_time: NaiveDateTime,
) -> Result<bool, BufkitDataErr>
pub fn file_exists( &self, site: StationNumber, 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 station_num_for_id(
&self,
id: &str,
model: Model,
) -> Result<StationNumber, BufkitDataErr>
pub fn station_num_for_id( &self, id: &str, model: Model, ) -> Result<StationNumber, BufkitDataErr>
Retrieve the most recent station number used with this ID and model.
Sourcepub fn ids(
&self,
station_num: StationNumber,
model: Model,
) -> Result<Vec<String>, BufkitDataErr>
pub fn ids( &self, station_num: StationNumber, model: Model, ) -> Result<Vec<String>, BufkitDataErr>
Retrieve a list of site ids use with the station number.
Sourcepub fn most_recent_id(
&self,
station_num: StationNumber,
model: Model,
) -> Result<Option<String>, BufkitDataErr>
pub fn most_recent_id( &self, station_num: StationNumber, model: Model, ) -> Result<Option<String>, BufkitDataErr>
Retrieve the most recently used ID with a site.
Sourcepub fn inventory(
&self,
station_num: StationNumber,
model: Model,
) -> Result<Vec<NaiveDateTime>, BufkitDataErr>
pub fn inventory( &self, station_num: StationNumber, model: Model, ) -> Result<Vec<NaiveDateTime>, BufkitDataErr>
Get an inventory of soundings for a site & model.
Sourcepub fn missing_inventory(
&self,
station_num: StationNumber,
model: Model,
time_range: Option<(NaiveDateTime, NaiveDateTime)>,
) -> Result<Vec<NaiveDateTime>, BufkitDataErr>
pub fn missing_inventory( &self, station_num: StationNumber, model: Model, time_range: Option<(NaiveDateTime, NaiveDateTime)>, ) -> Result<Vec<NaiveDateTime>, BufkitDataErr>
Get list of missing init times.
If time_range is None
, this will find the first and last entries and then look for any
gaps. If time_range is specified, then the end times are inclusive.
Sourcepub fn count(
&self,
station_num: StationNumber,
model: Model,
) -> Result<u32, BufkitDataErr>
pub fn count( &self, station_num: StationNumber, model: Model, ) -> Result<u32, BufkitDataErr>
Get the number of files in the archive for the given station and model.
Source§impl Archive
impl Archive
Sourcepub fn connect(root: &dyn AsRef<Path>) -> Result<Self, BufkitDataErr>
pub fn connect(root: &dyn AsRef<Path>) -> Result<Self, BufkitDataErr>
Open an existing archive.
Sourcepub fn root(&self) -> &Path
pub fn root(&self) -> &Path
Retrieve a path to the root. Allows caller to store files in the archive.
Sourcepub fn export(
&self,
stations: &[StationNumber],
models: &[Model],
start: NaiveDateTime,
end: NaiveDateTime,
dest: &Path,
) -> Result<(), BufkitDataErr>
pub fn export( &self, stations: &[StationNumber], models: &[Model], start: NaiveDateTime, end: NaiveDateTime, dest: &Path, ) -> Result<(), BufkitDataErr>
Export part of the archive.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Archive
impl !RefUnwindSafe for Archive
impl Send for Archive
impl !Sync for Archive
impl Unpin for Archive
impl !UnwindSafe for Archive
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> 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 more