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.