pub struct CausalSession<S: AtomicJournalStore> { /* private fields */ }Implementations§
Source§impl<S: AtomicJournalStore> CausalSession<S>
impl<S: AtomicJournalStore> CausalSession<S>
Sourcepub fn named_links(&mut self) -> CausalNamedLinks<'_>
pub fn named_links(&mut self) -> CausalNamedLinks<'_>
Standard named/query staging; preparation freezes the borrowed workspace.
pub fn new( batch: CausalBatch<S>, first: u64, last: u64, policy: CausalConflictPolicy, options: CausalWorkspaceOptions, ) -> Result<Self, LinkError>
pub fn prepare(&mut self, token: &str) -> Result<CausalPreparedBatch, LinkError>
pub fn prepared(&self) -> Option<CausalPreparedBatch>
pub fn commit(&mut self, token: &str) -> Result<Vec<CausalVersion>, LinkError>
pub fn rollback(&mut self)
pub fn rows(&self) -> Vec<Row<u64>>
pub fn get_name(&self, id: u64) -> Option<String>
pub fn get_by_name(&self, name: &str) -> Option<u64>
pub fn set_name( &mut self, id: u64, name: Option<String>, ) -> Result<(), LinkError>
Trait Implementations§
Source§impl<S: AtomicJournalStore> LinksStorage<u64> for CausalSession<S>
impl<S: AtomicJournalStore> LinksStorage<u64> for CausalSession<S>
Source§fn create_link(&mut self, source: u64, target: u64) -> Result<u64, LinkError>
fn create_link(&mut self, source: u64, target: u64) -> Result<u64, LinkError>
Creates a link and returns its address. A uniqueness resolver may return
an existing link after removing the temporary allocation.
Source§fn ensure_link_created(&mut self, id: u64) -> Result<u64, LinkError>
fn ensure_link_created(&mut self, id: u64) -> Result<u64, LinkError>
Ensures a link exists at
index, creating placeholders as needed.Source§fn get_link(&self, id: u64) -> Option<GenericLink<u64>>
fn get_link(&self, id: u64) -> Option<GenericLink<u64>>
Returns the link stored at
index, if any.Source§fn update_link(
&mut self,
id: u64,
source: u64,
target: u64,
) -> Result<GenericLink<u64>, LinkError>
fn update_link( &mut self, id: u64, source: u64, target: u64, ) -> Result<GenericLink<u64>, LinkError>
Repoints
index at source/target, returning the previous state.Source§fn delete_link(&mut self, id: u64) -> Result<GenericLink<u64>, LinkError>
fn delete_link(&mut self, id: u64) -> Result<GenericLink<u64>, LinkError>
Deletes
index, returning the link that was removed.Source§fn create_link_observed(
&mut self,
source: T,
target: T,
observer: &mut dyn FnMut(GenericLink<T>, GenericLink<T>),
) -> Result<T, LinkError>
fn create_link_observed( &mut self, source: T, target: T, observer: &mut dyn FnMut(GenericLink<T>, GenericLink<T>), ) -> Result<T, LinkError>
Self::create_link, reporting every change, including partial changes
before an error. Transactions need these callbacks to distinguish a new
allocation from a duplicate resolved into an existing link. Read moreSource§fn ensure_link_created_observed(
&mut self,
index: T,
observer: &mut dyn FnMut(GenericLink<T>, GenericLink<T>),
) -> Result<T, LinkError>
fn ensure_link_created_observed( &mut self, index: T, observer: &mut dyn FnMut(GenericLink<T>, GenericLink<T>), ) -> Result<T, LinkError>
Self::ensure_link_created, reporting every placeholder it creates. Read moreSource§fn link_exists(&self, index: T) -> bool
fn link_exists(&self, index: T) -> bool
Returns
true when a link exists at index.Source§fn restore_link(
&mut self,
index: T,
source: T,
target: T,
) -> Result<GenericLink<T>, LinkError>
fn restore_link( &mut self, index: T, source: T, target: T, ) -> Result<GenericLink<T>, LinkError>
Writes exactly this row for undo and replay, returning the previous state. Read more
Source§fn update_link_observed(
&mut self,
index: T,
source: T,
target: T,
observer: &mut dyn FnMut(GenericLink<T>, GenericLink<T>),
) -> Result<GenericLink<T>, LinkError>
fn update_link_observed( &mut self, index: T, source: T, target: T, observer: &mut dyn FnMut(GenericLink<T>, GenericLink<T>), ) -> Result<GenericLink<T>, LinkError>
Source§fn delete_link_observed(
&mut self,
index: T,
observer: &mut dyn FnMut(GenericLink<T>, GenericLink<T>),
) -> Result<GenericLink<T>, LinkError>
fn delete_link_observed( &mut self, index: T, observer: &mut dyn FnMut(GenericLink<T>, GenericLink<T>), ) -> Result<GenericLink<T>, LinkError>
Source§fn query_links(
&self,
index: Option<T>,
source: Option<T>,
target: Option<T>,
) -> Vec<GenericLink<T>>
fn query_links( &self, index: Option<T>, source: Option<T>, target: Option<T>, ) -> Vec<GenericLink<T>>
Returns every link matching the (optional) index/source/target pattern.
Source§fn search_link(&self, source: T, target: T) -> Option<T>
fn search_link(&self, source: T, target: T) -> Option<T>
Finds the address of a link with the given source and target.
Source§fn get_or_create_link(&mut self, source: T, target: T) -> Result<T, LinkError>
fn get_or_create_link(&mut self, source: T, target: T) -> Result<T, LinkError>
Returns the address of an existing
(source, target) link,
creating it when it does not exist yet.Source§fn links_count(&self) -> usize
fn links_count(&self) -> usize
Number of links currently stored.
Source§fn capture_names(&mut self) -> Result<Option<BTreeMap<T, String>>, LinkError>
fn capture_names(&mut self) -> Result<Option<BTreeMap<T, String>>, LinkError>
Optional logical name snapshot for transactional undo. Unnamed stores
return None without allocation. Include names of absent/external rows.
Source§fn set_link_name(
&mut self,
_index: T,
_name: Option<&str>,
) -> Result<T, LinkError>
fn set_link_name( &mut self, _index: T, _name: Option<&str>, ) -> Result<T, LinkError>
Changes one logical name without recording. A named adapter must restore
external-reference names even when their row currently does not exist.
Auto Trait Implementations§
impl<S> !Freeze for CausalSession<S>
impl<S> RefUnwindSafe for CausalSession<S>where
S: RefUnwindSafe,
impl<S> Send for CausalSession<S>where
S: Send,
impl<S> Sync for CausalSession<S>where
S: Sync,
impl<S> Unpin for CausalSession<S>where
S: Unpin,
impl<S> UnsafeUnpin for CausalSession<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for CausalSession<S>where
S: UnwindSafe,
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