pub struct PreparedRelationDeltaCommit<'a> { /* private fields */ }Expand description
A fully staged relation update bound to its authoritative and derived state.
The exclusive borrows prevent callers from mutating or substituting the authoritative store, cache, or runtime between preparation and commit. Dropping this value discards every staged update and prospective derived state. The authoritative store remains unchanged, while the borrowed cache and runtime slots remain empty because their prior values were consumed by preparation.
A prepared commit has no API for selecting a different destination:
use xlog_gpu::logic::PreparedRelationDeltaCommit;
use xlog_runtime::RelationStore;
fn commit_into_another_store(
prepared: PreparedRelationDeltaCommit<'_>,
other: &mut RelationStore,
) {
prepared.commit(other);
}The source store also remains exclusively borrowed until commit:
use std::sync::Arc;
use xlog_core::Result;
use xlog_cuda::{CudaBuffer, CudaKernelProvider};
use xlog_gpu::logic::{
LogicMaterializedStore, LogicProgram, LogicSessionRuntime, PreparedRelationDeltaBatch,
};
use xlog_runtime::RelationStore;
fn mutate_after_prepare(
program: &LogicProgram,
provider: Arc<CudaKernelProvider>,
store: &mut RelationStore,
cache: &mut Option<LogicMaterializedStore>,
runtime: &mut Option<LogicSessionRuntime>,
batch: PreparedRelationDeltaBatch,
replacement: CudaBuffer,
) -> Result<()> {
let prepared = program.prepare_relation_delta_commit_with_session_runtime(
provider, store, cache, runtime, batch,
)?;
store.put("fact", replacement);
prepared.commit();
Ok(())
}Implementations§
Source§impl PreparedRelationDeltaCommit<'_>
impl PreparedRelationDeltaCommit<'_>
Sourcepub fn prospective_derived_store(&self) -> &RelationStore
pub fn prospective_derived_store(&self) -> &RelationStore
Borrow the prospective materialized derived/cache store.
This store is suitable for direct query-result comparison. It must not seed an independent full recompute because it contains intensional heads that an executor may union with newly derived rows. For a no-op batch it returns retained derived state when available, or the unchanged authoritative store otherwise.
Sourcepub fn clone_prospective_base_store(&self) -> Result<RelationStore>
pub fn clone_prospective_base_store(&self) -> Result<RelationStore>
Clone the authoritative base snapshot with every staged base update overlaid.
This fallible, on-demand snapshot is the correct seed for an independent full recompute. It includes staged relations that were absent from the authoritative store and does not mutate authoritative contents or versions. Ordinary prepare and commit paths do not pay for these clones.
Sourcepub fn commit(self) -> LogicDeltaReport
pub fn commit(self) -> LogicDeltaReport
Install every staged base update and derived-state replacement together.
All allocation, destination-capacity reservation, recomputation, constraint validation, and buffer cloning has completed before this method is available, so committing only moves owned values and is infallible.