Skip to main content

VersionControlDecorator

Struct VersionControlDecorator 

Source
pub struct VersionControlDecorator { /* private fields */ }
Expand description

Decorator that adds time travel, branching, and tagging over the transitions log produced by a TransactionsDecorator.

Implementations§

Source§

impl VersionControlDecorator

Source

pub fn new( transactions: TransactionsDecorator, branches_store: NamedTypesDecorator, trace: bool, ) -> Result<Self>

Source

pub fn make_version_control_database_filename<P: AsRef<Path>>(p: P) -> PathBuf

Conventional sidecar filename for the version-control store.

Source

pub fn current_branch(&self) -> &str

Source

pub fn current_sequence(&self) -> i64

Source

pub fn list_branches(&self) -> Vec<BranchInfo>

Source

pub fn list_tags(&self) -> BTreeMap<String, i64>

Source

pub fn try_get_tag(&self, name: &str) -> Option<i64>

Source

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

Source

pub fn transactions(&self) -> &TransactionsDecorator

Source

pub fn transactions_mut(&mut self) -> &mut TransactionsDecorator

Source

pub fn branches_store(&self) -> &NamedTypesDecorator

Source

pub fn begin_transaction(&mut self) -> Result<TransactionHandle>

Source

pub fn commit(&mut self) -> Result<()>

Source

pub fn rollback(&mut self) -> Result<()>

Source

pub fn create(&mut self, source: u32, target: u32) -> Result<u32>

Source

pub fn update(&mut self, id: u32, source: u32, target: u32) -> Result<Link>

Source

pub fn delete(&mut self, id: u32) -> Result<Link>

Source

pub fn create_and_update(&mut self, source: u32, target: u32) -> Result<u32>

Source

pub fn exists(&self, id: u32) -> bool

Source

pub fn get(&self, id: u32) -> Option<&Link>

Source

pub fn all(&self) -> Vec<&Link>

Source

pub fn search(&self, source: u32, target: u32) -> Option<u32>

Source

pub fn get_or_create(&mut self, source: u32, target: u32) -> Result<u32>

Source

pub fn ensure_created(&mut self, id: u32) -> u32

Source

pub fn branch(&mut self, name: &str, from: Option<i64>) -> Result<()>

Source

pub fn switch_branch(&mut self, name: &str) -> Result<()>

Source

pub fn checkout(&mut self, sequence: i64) -> Result<()>

Source

pub fn tag(&mut self, name: &str, sequence: Option<i64>) -> Result<()>

Source

pub fn recover(&mut self) -> Result<()>

Trait Implementations§

Source§

fn create(&mut self, source: u32, target: u32) -> u32

Source§

fn ensure_created(&mut self, id: u32) -> u32

Source§

fn exists(&mut self, id: u32) -> bool

Source§

fn update(&mut self, id: u32, source: u32, target: u32) -> Result<Link>

Source§

fn delete(&mut self, id: u32) -> Result<Link>

Source§

fn search(&mut self, source: u32, target: u32) -> Option<u32>

Source§

fn get_or_create(&mut self, source: u32, target: u32) -> u32

Source§

fn get_name(&mut self, id: u32) -> Result<Option<String>>

Source§

fn set_name(&mut self, id: u32, name: &str) -> Result<u32>

Source§

fn get_by_name(&mut self, name: &str) -> Result<Option<u32>>

Source§

fn remove_name(&mut self, id: u32) -> Result<()>

Source§

fn save(&mut self) -> Result<()>

Source§

fn try_ensure_created(&mut self, id: u32) -> Result<u32>

Source§

fn get_or_create_named(&mut self, name: &str) -> Result<u32>

Source§

fn format_reference(&mut self, id: u32) -> Result<String>

Source§

fn format_lino(&mut self, link: &Link) -> Result<String>

Source§

fn lino_lines(&mut self) -> Result<Vec<String>>

Source§

fn write_lino_output<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

Source§

fn print_all_lino(&mut self) -> Result<()>

Source§

fn print_change_lino( &mut self, before: &Option<Link>, after: &Option<Link>, ) -> Result<()>

Source§

fn format_structure(&mut self, id: u32) -> Result<String>

Source§

fn format_structure_recursive( &mut self, id: u32, visited: &mut HashSet<u32>, ) -> Result<String>

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.