pub struct WriteTxn<'g> { /* private fields */ }Expand description
RAII owner of the single graph write lock.
Since v1.2 (BRIEF 1) the transaction no longer holds the snapshot cell,
schema-version, or provider handles — those moved to the single committer
thread, which the transaction reaches via the cheap Committer submit
handle. The transaction still owns the write lock + allocator guards for the
duration of execution and releases them when seal consumes it.
Implementations§
Source§impl<'g> WriteTxn<'g>
impl<'g> WriteTxn<'g>
Sourcepub fn read(&self) -> &SeleneGraph
pub fn read(&self) -> &SeleneGraph
Borrow the transaction-local working graph.
Sourcepub fn commit(self) -> GraphResult<CommitOutcome>
pub fn commit(self) -> GraphResult<CommitOutcome>
Commit without caller principal bytes.
Sourcepub fn commit_with_principal(
self,
principal: Option<Arc<[u8]>>,
) -> GraphResult<CommitOutcome>
pub fn commit_with_principal( self, principal: Option<Arc<[u8]>>, ) -> GraphResult<CommitOutcome>
Commit with optional caller-owned principal bytes for D12 audit replay.
Since v1.2 (BRIEF 1) commit is seal-and-handover: this method runs
seal on the calling thread (generation/meta bump + GG02
validation under the write lock, then lock release), then submits the
resulting SealedCommit to the per-graph single committer thread and
blocks until it is durable + visible. The public contract is unchanged —
“commit() returns ⇒ durable + visible” — only the internal threading
model differs.
GG02 closed-graph violations still abort here, on the calling thread, before any handoff, so error timing is identical to v1.0/v1.1.
Registered index providers are notified by the committer after the new
snapshot is published; the same-thread re-entrancy guard now protects the
committer thread (one committer ⇒ still sound). Same-thread re-entrant
provider calls into SharedGraph::begin_write() are detected via the
thread-local fanout counter and panic with a clear message; the
committer’s fan-out boundary catches those panics (along with
callback-internal panics and returned errors) so a single misbehaving
provider can never crash the committer thread.
§Errors
Returns the GG02 / validation error from seal, or a
GraphError::Durable if the WAL append failed or the committer thread
is no longer running.
Sourcepub fn change_count(&self) -> usize
pub fn change_count(&self) -> usize
Number of changes accumulated since this transaction opened.
Sourcepub fn has_schema_changes(&self) -> bool
pub fn has_schema_changes(&self) -> bool
Whether this transaction has accumulated schema-changing work.
Trait Implementations§
Auto Trait Implementations§
impl<'g> !RefUnwindSafe for WriteTxn<'g>
impl<'g> !Send for WriteTxn<'g>
impl<'g> !UnwindSafe for WriteTxn<'g>
impl<'g> Freeze for WriteTxn<'g>
impl<'g> Sync for WriteTxn<'g>
impl<'g> Unpin for WriteTxn<'g>
impl<'g> UnsafeUnpin for WriteTxn<'g>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
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>
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>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.