pub struct VerLink { /* private fields */ }Expand description
A linked list tracking a logic “version” with compatibility rules:
- Append-only changes bump the version, the new version is backwards compatible.
- Non-append-only changes create a new version that is incompatible with all other versions (in the current process).
- Clones (cheaply) preserve the version.
Supported operations:
new() -> x: Create a new version that is not comparable (compatible) with other versions.clone(x) -> y: Clonextoy.x == y.xandyare compatible.bump(x) -> y: Bumpxtoy.y > x.yis backwards-compatible withx. Note:yis not comparable (compatible) with otherbump(x).x > y:trueifxis backwards compatible withy.
The linked list can be shared in other linked lists. So they form a tree effectively. Comparing to a DAG, there is no “merge” operation. Compatibility questions become reachability questions.
Implementations§
Source§impl VerLink
impl VerLink
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new VerLink that is incompatible with all other VerLinks
in the process.
Sourcepub fn bump(&mut self)
pub fn bump(&mut self)
Bumps the VerLink for backward-compatible (ex. append-only) changes.
Note the “append-only” means only adding commits without “stripping”
or “rewriting” commits. It is different from the “append-only” concept
from the storage layer, because the “stripping” or “rewriting” might
be implemented as “appending” special data on the storage layer.
Source§impl VerLink
impl VerLink
Sourcepub fn clear_storage_version_cache()
pub fn clear_storage_version_cache()
Clear the cache that maps storage version to VerLink.
Sourcepub fn from_storage_version(
str_id: &str,
version: (u64, u64),
) -> Option<VerLink>
pub fn from_storage_version( str_id: &str, version: (u64, u64), ) -> Option<VerLink>
Lookup a VerLink from a given storage version.
Sourcepub fn associate_storage_version(&self, str_id: String, version: (u64, u64))
pub fn associate_storage_version(&self, str_id: String, version: (u64, u64))
Associate the VerLink with a storage version.
Trait Implementations§
Source§impl<'a> From<&'a VerLink> for DagVersion<'a>
impl<'a> From<&'a VerLink> for DagVersion<'a>
Source§impl<'a> From<&'a VerLink> for IdMapVersion<'a>
impl<'a> From<&'a VerLink> for IdMapVersion<'a>
Auto Trait Implementations§
impl Freeze for VerLink
impl RefUnwindSafe for VerLink
impl Send for VerLink
impl Sync for VerLink
impl Unpin for VerLink
impl UnsafeUnpin for VerLink
impl UnwindSafe for VerLink
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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