Repository

Struct Repository 

Source
pub struct Repository {
    pub description: RootDescription,
    /* private fields */
}
Expand description

Definition of a brevdash data repository.

Fields§

§description: RootDescription

The root description string.

Implementations§

Source§

impl Repository

Source

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open a repository from a directory path.

Source

pub fn create<P: AsRef<Path>>( path: P, description: RootDescription, ) -> Result<Self>

Create a repository at a directory path.

The directory must already exist and be writable.

Source

pub fn store_description(&self) -> Result<()>

Store the description file inside the repository.

Source

pub fn project_datapoint_artifacts_directory_path( &self, project_id: &str, date: NaiveDate, ) -> PathBuf

Get the path for the artifacts of a project at a specific date.

Source

pub fn project_datapoint_characteristic_artifacts_directory_path( &self, project_id: &str, date: NaiveDate, characteristic_id: &str, ) -> PathBuf

Get the path for the artifacts of a characteristic at a specific date.

Source

pub fn project_datapoint_characteristic_artifact_path( &self, project_id: &str, date: NaiveDate, characteristic_id: &str, artifact_relative_path: &Path, ) -> PathBuf

Get the path for an artifact.

Source

pub fn load_project_ids(&self) -> Result<Vec<String>>

Load the list of project ids inside the repository.

Source

pub fn has_project(&self, project_id: &str) -> bool

Query whether the repository contains a project with a specific id.

Source

pub fn store_project_description( &self, project_id: &str, description: &ProjectDescription, ) -> Result<()>

Store the description of a project.

Source

pub fn load_project_description( &self, project_id: &str, ) -> Result<ProjectDescription>

Load the description of a project by id.

Source

pub fn load_project_descriptions( &self, ) -> Result<BTreeMap<String, ProjectDescription>>

Load the descriptions for all projects.

Source

pub fn project_has_datapoint_date( &self, project_id: &str, date: NaiveDate, ) -> bool

Query whether the repository contains a datapoint at a specific date.

Source

pub fn load_project_datapoint_dates( &self, project_id: &str, ) -> Result<Vec<NaiveDate>>

Load a list of all datapoint dates for a specific project id.

Source

pub fn store_project_datapoint( &self, project_id: &str, date: NaiveDate, datapoint: &DataPoint, ) -> Result<()>

Store a datapoint at a specific date.

Source

pub fn load_project_datapoint( &self, project_id: &str, date: NaiveDate, ) -> Result<DataPoint>

Load a datapoint at a specific date.

Source

pub fn load_project_datapoints( &self, project_id: &str, ) -> Result<BTreeMap<NaiveDate, DataPoint>>

Load all datapoints for a project id.

Trait Implementations§

Source§

impl Debug for Repository

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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.