Skip to main content

CausalSession

Struct CausalSession 

Source
pub struct CausalSession<S: AtomicJournalStore> { /* private fields */ }

Implementations§

Source§

impl<S: AtomicJournalStore> CausalSession<S>

Standard named/query staging; preparation freezes the borrowed workspace.

Source

pub fn new( batch: CausalBatch<S>, first: u64, last: u64, policy: CausalConflictPolicy, options: CausalWorkspaceOptions, ) -> Result<Self, LinkError>

Source

pub fn prepare(&mut self, token: &str) -> Result<CausalPreparedBatch, LinkError>

Source

pub fn prepared(&self) -> Option<CausalPreparedBatch>

Source

pub fn commit(&mut self, token: &str) -> Result<Vec<CausalVersion>, LinkError>

Source

pub fn rollback(&mut self)

Source

pub fn rows(&self) -> Vec<Row<u64>>

Source

pub fn get_name(&self, id: u64) -> Option<String>

Source

pub fn get_by_name(&self, name: &str) -> Option<u64>

Source

pub fn set_name( &mut self, id: u64, name: Option<String>, ) -> Result<(), LinkError>

Trait Implementations§

Source§

impl<S: AtomicJournalStore> LinksStorage<u64> for CausalSession<S>

Creates a link and returns its address. A uniqueness resolver may return an existing link after removing the temporary allocation.
Ensures a link exists at index, creating placeholders as needed.
Returns the link stored at index, if any.
Repoints index at source/target, returning the previous state.
Deletes index, returning the link that was removed.
Returns every link in the store.
Source§

fn flush(&mut self) -> Result<(), LinkError>

Makes every write durable on disk. Read more
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 more
Self::ensure_link_created, reporting every placeholder it creates. Read more
Returns true when a link exists at index.
Writes exactly this row for undo and replay, returning the previous state. Read more
Self::update_link, reporting every (before, after) change it made. Read more
Self::delete_link, reporting every (before, after) change it made. Read more
Returns every link matching the (optional) index/source/target pattern.
Finds the address of a link with the given source and target.
Returns the address of an existing (source, target) link, creating it when it does not exist yet.
Number of links currently stored.
Source§

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.
Changes one logical name without recording. A named adapter must restore external-reference names even when their row currently does not exist.
Source§

fn has_external_changes(&self) -> Result<bool, LinkError>

Cheap check for “did another process write to this database since we last read or wrote it?”. Read more
Source§

fn reload(&mut self) -> Result<(), LinkError>

Re-reads the database from disk, discarding cached state. Read more

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.