pub struct InProgress<'a, 'c> {
pub transaction: Transaction<'c>,
pub mutex: &'a Mutex<Metadata>,
pub generation: u64,
pub partition_map: PartitionMap,
pub schema: Schema,
pub cache: InProgressSQLiteAttributeCache,
pub use_caching: bool,
pub tx_observer: &'a Mutex<TxObservationService>,
pub tx_observer_watcher: InProgressObserverTransactWatcher,
}Expand description
Represents an in-progress, not yet committed, set of changes to the store.
Call commit to commit your changes, or rollback to discard them.
A transaction is held open until you do so.
Your changes will be implicitly dropped along with this struct.
Fields§
§transaction: Transaction<'c>§mutex: &'a Mutex<Metadata>§generation: u64§partition_map: PartitionMap§schema: Schema§cache: InProgressSQLiteAttributeCache§use_caching: bool§tx_observer: &'a Mutex<TxObservationService>§tx_observer_watcher: InProgressObserverTransactWatcherImplementations§
Source§impl<'a, 'c> InProgress<'a, 'c>
impl<'a, 'c> InProgress<'a, 'c>
pub fn builder(self) -> InProgressBuilder<'a, 'c>
Sourcepub fn use_caching(&mut self, yesno: bool)
pub fn use_caching(&mut self, yesno: bool)
Choose whether to use in-memory caches for running queries.
Sourcepub fn transact_builder(
&mut self,
builder: TermBuilder,
) -> Result<TxReport, MentatError>
pub fn transact_builder( &mut self, builder: TermBuilder, ) -> Result<TxReport, MentatError>
If you only have a reference to an InProgress, you can’t use the easy builder.
This exists so you can make your own.
pub fn transact_terms<I>(
&mut self,
terms: I,
tempid_set: InternSet<TempId>,
) -> Result<TxReport, MentatError>where
I: IntoIterator<Item = Term<Either<KnownEntid, Arc<TempId>>, Either<TypedValue, Arc<TempId>>>>,
pub fn transact_entities<I, V>( &mut self, entities: I, ) -> Result<TxReport, MentatError>
pub fn transact<B>(&mut self, transaction: B) -> Result<TxReport, MentatError>
Sourcepub fn transact_speculative<B>(
&mut self,
transaction: B,
) -> Result<TxReport, MentatError>
pub fn transact_speculative<B>( &mut self, transaction: B, ) -> Result<TxReport, MentatError>
Speculatively apply an EDN transaction and return its TxReport WITHOUT
persisting any changes – the equivalent of Datomic’s d/with and
pg_mentat’s mentat.with. Runs the transaction through the exact same
code path as a real transact (so tempid resolution, constraint checking
and cardinality handling are identical), inside a SAVEPOINT, then rolls
back both the SQLite writes and the in-memory partition_map/schema
mutations so the InProgress is left exactly as it was.
The returned report’s tx_id, tempids and datoms reflect what would
have happened; a subsequent real transact will allocate fresh ids.
Sourcepub fn transact_entities_speculative<I, V>(
&mut self,
entities: I,
) -> Result<TxReport, MentatError>
pub fn transact_entities_speculative<I, V>( &mut self, entities: I, ) -> Result<TxReport, MentatError>
Entity-level speculative transact. See [transact_speculative].
pub fn import<P>(&mut self, path: P) -> Result<TxReport, MentatError>
pub fn rollback(self) -> Result<(), MentatError>
pub fn commit(self) -> Result<(), MentatError>
pub fn cache( &mut self, attribute: &Keyword, cache_direction: CacheDirection, cache_action: CacheAction, ) -> Result<(), MentatError>
pub fn last_tx_id(&self) -> i64
pub fn savepoint(&self, name: &str) -> Result<(), MentatError>
pub fn rollback_savepoint(&self, name: &str) -> Result<(), MentatError>
pub fn release_savepoint(&self, name: &str) -> Result<(), MentatError>
Trait Implementations§
Source§impl<'a, 'c> HasSchema for InProgress<'a, 'c>
impl<'a, 'c> HasSchema for InProgress<'a, 'c>
Source§fn is_attribute<T>(&self, x: T) -> bool
fn is_attribute<T>(&self, x: T) -> bool
Return true if the provided entid identifies an attribute in this schema.
Source§fn identifies_attribute(&self, x: &Keyword) -> bool
fn identifies_attribute(&self, x: &Keyword) -> bool
Return true if the provided ident identifies an attribute in this schema.
fn entid_for_type(&self, t: ValueType) -> Option<KnownEntid>
fn get_ident<T>(&self, x: T) -> Option<&Keyword>
fn get_entid(&self, x: &Keyword) -> Option<KnownEntid>
fn attribute_for_entid<T>(&self, x: T) -> Option<&Attribute>
fn attribute_for_ident( &self, ident: &Keyword, ) -> Option<(&Attribute, KnownEntid)>
fn component_attributes(&self) -> &[i64]
Source§impl<'a, 'c> Pullable for InProgress<'a, 'c>
impl<'a, 'c> Pullable for InProgress<'a, 'c>
fn pull_attributes_for_entities<E, A>( &self, entities: E, attributes: A, ) -> Result<BTreeMap<i64, Arc<StructuredMap>>, MentatError>
fn pull_attributes_for_entity<A>(
&self,
entity: i64,
attributes: A,
) -> Result<StructuredMap, MentatError>where
A: IntoIterator<Item = i64>,
Source§impl<'a, 'c> Queryable for InProgress<'a, 'c>
impl<'a, 'c> Queryable for InProgress<'a, 'c>
fn q_once<T>(&self, query: &str, inputs: T) -> Result<QueryOutput, MentatError>
fn q_prepare<T>( &self, query: &str, inputs: T, ) -> Result<PreparedQuery<'_>, MentatError>
fn q_explain<T>( &self, query: &str, inputs: T, ) -> Result<QueryExplanation, MentatError>
fn lookup_values_for_attribute<E>( &self, entity: E, attribute: &Keyword, ) -> Result<Vec<TypedValue>, MentatError>
fn lookup_value_for_attribute<E>( &self, entity: E, attribute: &Keyword, ) -> Result<Option<TypedValue>, MentatError>
Source§impl VersionedStore for InProgress<'_, '_>
impl VersionedStore for InProgress<'_, '_>
Source§fn ensure_vocabulary(
&mut self,
definition: &Definition,
) -> Result<VocabularyOutcome>
fn ensure_vocabulary( &mut self, definition: &Definition, ) -> Result<VocabularyOutcome>
Source§fn ensure_vocabularies(
&mut self,
vocabularies: &mut dyn VocabularySource,
) -> Result<BTreeMap<Keyword, VocabularyOutcome>>
fn ensure_vocabularies( &mut self, vocabularies: &mut dyn VocabularySource, ) -> Result<BTreeMap<Keyword, VocabularyOutcome>>
pre
function on the provided VocabularySource, install or upgrade the necessary vocabularies,
then invoke post. Returns Ok if all of these steps succeed. Read moreSource§fn check_vocabulary<'definition>(
&self,
definition: &'definition Definition,
) -> Result<VocabularyCheck<'definition>>
fn check_vocabulary<'definition>( &self, definition: &'definition Definition, ) -> Result<VocabularyCheck<'definition>>
Source§fn verify_core_schema(&self) -> Result<()>
fn verify_core_schema(&self) -> Result<()>
Auto Trait Implementations§
impl<'a, 'c> !RefUnwindSafe for InProgress<'a, 'c>
impl<'a, 'c> !Send for InProgress<'a, 'c>
impl<'a, 'c> !Sync for InProgress<'a, 'c>
impl<'a, 'c> !UnwindSafe for InProgress<'a, 'c>
impl<'a, 'c> Freeze for InProgress<'a, 'c>
impl<'a, 'c> Unpin for InProgress<'a, 'c>
impl<'a, 'c> UnsafeUnpin for InProgress<'a, '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
Source§impl<T> HasVocabularies for T
impl<T> HasVocabularies for T
fn read_vocabulary_named( &self, name: &Keyword, ) -> Result<Option<Vocabulary>, MentatError>
fn read_vocabularies(&self) -> Result<Vocabularies, MentatError>
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 more