pub struct CCDB { /* private fields */ }Expand description
Read-only client for the Jefferson Lab Calibration and Conditions Database.
Implementations§
Source§impl CCDB
impl CCDB
Sourcepub fn new() -> CCDBResult<Self>
pub fn new() -> CCDBResult<Self>
Opens a read-only handle using the CCDB_CONNECTION environment variable.
§Errors
This method returns an error if the environment variable is not set or the database cannot be opened.
Sourcepub fn open(path: impl AsRef<Path>) -> CCDBResult<Self>
pub fn open(path: impl AsRef<Path>) -> CCDBResult<Self>
Opens a read-only connection to an existing CCDB SQLite database file.
§Errors
This method returns an error if the database cannot be opened.
Sourcepub fn connection(&self) -> MutexGuard<'_, Connection>
pub fn connection(&self) -> MutexGuard<'_, Connection>
Returns the underlying rusqlite::Connection.
Sourcepub fn connection_path(&self) -> &str
pub fn connection_path(&self) -> &str
Returns the filesystem path used to open the database.
Sourcepub fn root(&self) -> DirectoryHandle
pub fn root(&self) -> DirectoryHandle
Returns a handle to the virtual root directory.
Sourcepub fn dir(&self, path: &str) -> CCDBResult<DirectoryHandle>
pub fn dir(&self, path: &str) -> CCDBResult<DirectoryHandle>
Resolves an absolute or relative directory path into a handle.
§Errors
This method returns an error if the directory cannot be found.
Sourcepub fn table(&self, path: &str) -> CCDBResult<TypeTableHandle>
pub fn table(&self, path: &str) -> CCDBResult<TypeTableHandle>
Resolves a table path (“/dir/name”) into a handle.
§Errors
This method returns an error if the table cannot be found.
Sourcepub fn variation(&self, name: &str) -> CCDBResult<VariationMeta>
pub fn variation(&self, name: &str) -> CCDBResult<VariationMeta>
Loads variation metadata, caching repeated lookups.
§Errors
This method returns an error if the variation cannot be found.
Sourcepub fn variation_chain(
&self,
start: &VariationMeta,
) -> CCDBResult<Vec<VariationMeta>>
pub fn variation_chain( &self, start: &VariationMeta, ) -> CCDBResult<Vec<VariationMeta>>
Resolves a variation chain from the given starting variation up to the root.
§Errors
This method returns an error if any of the variations cannot be found.
Sourcepub fn fetch(
&self,
path: &str,
ctx: &CCDBContext,
) -> CCDBResult<BTreeMap<RunNumber, Data>>
pub fn fetch( &self, path: &str, ctx: &CCDBContext, ) -> CCDBResult<BTreeMap<RunNumber, Data>>
Fetches data for a table path using the supplied CCDBContext.
§Errors
This method returns an error if the parsed table path does not exist or an error occurs while fetching data.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CCDB
impl !RefUnwindSafe for CCDB
impl Send for CCDB
impl Sync for CCDB
impl Unpin for CCDB
impl !UnwindSafe for CCDB
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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