pub struct ClawTransaction<'c> { /* private fields */ }Expand description
A wrapper around a SQLite transaction with staged memory operations.
Implementations§
Source§impl<'c> ClawTransaction<'c>
impl<'c> ClawTransaction<'c>
Sourcepub async fn begin(engine: &'c ClawEngine) -> ClawResult<ClawTransaction<'c>>
pub async fn begin(engine: &'c ClawEngine) -> ClawResult<ClawTransaction<'c>>
Begin a new transaction against the engine’s connection pool.
Sourcepub fn pending_cache_ops(&self) -> &[CacheOp]
pub fn pending_cache_ops(&self) -> &[CacheOp]
Return a slice of staged cache operations.
Sourcepub async fn insert_memory(&mut self, record: &MemoryRecord) -> ClawResult<Uuid>
pub async fn insert_memory(&mut self, record: &MemoryRecord) -> ClawResult<Uuid>
Stage insertion of a MemoryRecord.
Sourcepub fn update_memory(&mut self, id: Uuid, content: impl Into<String>)
pub fn update_memory(&mut self, id: Uuid, content: impl Into<String>)
Stage update of memory content.
Sourcepub fn delete_memory(&mut self, id: Uuid)
pub fn delete_memory(&mut self, id: Uuid)
Stage deletion of a memory row.
Sourcepub async fn commit(self) -> ClawResult<()>
pub async fn commit(self) -> ClawResult<()>
Commit all staged operations atomically.
Sourcepub async fn rollback(self) -> ClawResult<()>
pub async fn rollback(self) -> ClawResult<()>
Explicitly roll back the transaction, discarding all staged changes.
Sourcepub fn inner_mut(&mut self) -> &mut Transaction<'c, Sqlite>
pub fn inner_mut(&mut self) -> &mut Transaction<'c, Sqlite>
Return a mutable reference to the inner SQLx transaction.
Trait Implementations§
Auto Trait Implementations§
impl<'c> Freeze for ClawTransaction<'c>
impl<'c> !RefUnwindSafe for ClawTransaction<'c>
impl<'c> Send for ClawTransaction<'c>
impl<'c> Sync for ClawTransaction<'c>
impl<'c> Unpin for ClawTransaction<'c>
impl<'c> UnsafeUnpin for ClawTransaction<'c>
impl<'c> !UnwindSafe for ClawTransaction<'c>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more