pub struct TransactionsDecorator { /* private fields */ }Expand description
The transactions decorator wraps a NamedTypesDecorator and
records every write as a reversible Transition in log_store.
Implementations§
Source§impl TransactionsDecorator
impl TransactionsDecorator
Sourcepub fn new(
inner: NamedTypesDecorator,
log_store: NamedTypesDecorator,
retention_policy: LogRetentionPolicy,
commit_mode: CommitMode,
trace: bool,
) -> Result<Self>
pub fn new( inner: NamedTypesDecorator, log_store: NamedTypesDecorator, retention_policy: LogRetentionPolicy, commit_mode: CommitMode, trace: bool, ) -> Result<Self>
Creates a new transactions decorator wrapping inner, using
log_store as the sidecar log store.
Sourcepub fn make_transitions_database_filename<P: AsRef<Path>>(
database_filename: P,
) -> PathBuf
pub fn make_transitions_database_filename<P: AsRef<Path>>( database_filename: P, ) -> PathBuf
Conventional sidecar filename for the transitions log.
pub fn retention_policy(&self) -> &LogRetentionPolicy
pub fn set_retention_policy(&mut self, policy: LogRetentionPolicy)
pub fn commit_mode(&self) -> CommitMode
pub fn set_commit_mode(&mut self, mode: CommitMode)
pub fn applied_sequence(&self) -> i64
pub fn last_logged_sequence(&self) -> i64
Sourcepub fn log(&self) -> Vec<Transition>
pub fn log(&self) -> Vec<Transition>
Returns a snapshot of the transitions log in sequence order.
pub fn inner(&self) -> &NamedTypesDecorator
pub fn inner_mut(&mut self) -> &mut NamedTypesDecorator
pub fn log_store(&self) -> &NamedTypesDecorator
pub fn log_store_mut(&mut self) -> &mut NamedTypesDecorator
pub fn into_inner(self) -> (NamedTypesDecorator, NamedTypesDecorator)
pub fn save(&self) -> Result<()>
pub fn create(&mut self, source: u32, target: u32) -> Result<u32>
pub fn update(&mut self, id: u32, source: u32, target: u32) -> Result<Link>
pub fn delete(&mut self, id: u32) -> Result<Link>
Sourcepub fn create_and_update(&mut self, source: u32, target: u32) -> Result<u32>
pub fn create_and_update(&mut self, source: u32, target: u32) -> Result<u32>
Composite create-and-update used by callers that want a link
initialised with source/target in a single pair of transitions
(matches the C# CreateAndUpdate extension semantics, which
always emits a Create followed by an Update transition).
pub fn exists(&self, id: u32) -> bool
pub fn get(&self, id: u32) -> Option<&Link>
pub fn all(&self) -> Vec<&Link>
pub fn query( &self, index: Option<u32>, source: Option<u32>, target: Option<u32>, ) -> Vec<&Link>
pub fn search(&self, source: u32, target: u32) -> Option<u32>
pub fn get_or_create(&mut self, source: u32, target: u32) -> Result<u32>
pub fn ensure_created(&mut self, id: u32) -> u32
pub fn begin_transaction(&mut self) -> Result<TransactionHandle>
pub fn commit(&mut self) -> Result<()>
pub fn rollback(&mut self) -> Result<()>
Sourcepub fn apply_transition(&mut self, transition: &Transition)
pub fn apply_transition(&mut self, transition: &Transition)
Public helper for higher-level decorators (e.g. version control) — applies a single transition without writing a new log entry.
Sourcepub fn revert_transition(&mut self, transition: &Transition)
pub fn revert_transition(&mut self, transition: &Transition)
Public helper for higher-level decorators (e.g. version control) — reverts a single transition without writing a new log entry.