Struct Archive

Source
pub struct Archive { /* private fields */ }
Expand description

The archive.

Implementations§

Source§

impl Archive

Source

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

Source

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.

Source

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.

Source

pub fn update_site(&self, site: &SiteInfo) -> Result<(), BufkitDataErr>

Modify a site’s values.

Source

pub fn remove( &self, station_num: StationNumber, model: Model, init_time: NaiveDateTime, ) -> Result<(), BufkitDataErr>

Remove a file from the archive.

Source

pub fn remove_site( &self, station_num: StationNumber, ) -> Result<(), BufkitDataErr>

Remove a site and all of its files from the archive.

Source§

impl Archive

Source

pub fn station_summaries(&self) -> Result<Vec<StationSummary>, BufkitDataErr>

Get a summary of all the stations in the archive.

Source§

impl Archive

Source

pub fn sites(&self) -> Result<Vec<SiteInfo>, BufkitDataErr>

Retrieve a list of sites in the archive.

Source

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.

Source

pub fn site(&self, station_num: StationNumber) -> Option<SiteInfo>

Retrieve the information about a single site id

Source

pub fn models( &self, station_num: StationNumber, ) -> Result<Vec<Model>, BufkitDataErr>

Get a list of models in the archive for this site.

Source

pub fn retrieve( &self, station_num: StationNumber, model: Model, init_time: NaiveDateTime, ) -> Result<String, BufkitDataErr>

Retrieve a file from the archive.

Source

pub fn retrieve_most_recent( &self, station_num: StationNumber, model: Model, ) -> Result<String, BufkitDataErr>

Retrieve the most recent file.

Source

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.

Source

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.

Source

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.

Source

pub fn ids( &self, station_num: StationNumber, model: Model, ) -> Result<Vec<String>, BufkitDataErr>

Retrieve a list of site ids use with the station number.

Source

pub fn most_recent_id( &self, station_num: StationNumber, model: Model, ) -> Result<Option<String>, BufkitDataErr>

Retrieve the most recently used ID with a site.

Source

pub fn inventory( &self, station_num: StationNumber, model: Model, ) -> Result<Vec<NaiveDateTime>, BufkitDataErr>

Get an inventory of soundings for a site & model.

Source

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.

Source

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

Source

pub fn create(root: &dyn AsRef<Path>) -> Result<Self, BufkitDataErr>

Initialize a new archive.

Source

pub fn connect(root: &dyn AsRef<Path>) -> Result<Self, BufkitDataErr>

Open an existing archive.

Source

pub fn root(&self) -> &Path

Retrieve a path to the root. Allows caller to store files in the archive.

Source

pub fn export( &self, stations: &[StationNumber], models: &[Model], start: NaiveDateTime, end: NaiveDateTime, dest: &Path, ) -> Result<(), BufkitDataErr>

Export part of the archive.

Trait Implementations§

Source§

impl Debug for Archive

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.