pub struct VersionRegistry {
pub dataset_name: String,
pub versions: HashMap<String, ProvenanceInfo>,
pub current_version: Option<String>,
}Expand description
Dataset version registry for managing multiple versions
Fields§
§dataset_name: StringName of the dataset
versions: HashMap<String, ProvenanceInfo>All registered versions
current_version: Option<String>Current/latest version
Implementations§
Source§impl VersionRegistry
impl VersionRegistry
pub fn new(dataset_name: String) -> Self
pub fn register_version(&mut self, provenance: ProvenanceInfo)
pub fn get_version(&self, version: &str) -> Option<&ProvenanceInfo>
pub fn get_current(&self) -> Option<&ProvenanceInfo>
pub fn set_current(&mut self, version: &str) -> VersioningResult<()>
Sourcepub fn list_versions(&self) -> Vec<&ProvenanceInfo>
pub fn list_versions(&self) -> Vec<&ProvenanceInfo>
List all versions in chronological order
Sourcepub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> VersioningResult<()>
pub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> VersioningResult<()>
Save version registry to a JSON file
Sourcepub fn load_from_file<P: AsRef<Path>>(path: P) -> VersioningResult<Self>
pub fn load_from_file<P: AsRef<Path>>(path: P) -> VersioningResult<Self>
Load version registry from a JSON file
Trait Implementations§
Source§impl Clone for VersionRegistry
impl Clone for VersionRegistry
Source§fn clone(&self) -> VersionRegistry
fn clone(&self) -> VersionRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VersionRegistry
impl Debug for VersionRegistry
Source§impl<'de> Deserialize<'de> for VersionRegistry
impl<'de> Deserialize<'de> for VersionRegistry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for VersionRegistry
impl RefUnwindSafe for VersionRegistry
impl Send for VersionRegistry
impl Sync for VersionRegistry
impl Unpin for VersionRegistry
impl UnsafeUnpin for VersionRegistry
impl UnwindSafe for VersionRegistry
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
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 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>
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