MCPcopy Create free account
hub / github.com/cosdata/cosdata / new

Method new

src/models/collection_transaction.rs:155–170  ·  view source on GitHub ↗
(collection: &Collection, config: &Config)

Source from the content-addressed store, hash-verified

153
154impl ExplicitTransaction {
155 pub fn new(collection: &Collection, config: &Config) -> Result<Self, WaCustomError> {
156 let mut current_implicit_txn = collection.current_implicit_transaction.write();
157 mem::take(&mut *current_implicit_txn).pre_commit(collection, config)?;
158 let id = ExplicitTransactionID(random());
159 collection.transaction_status_map.insert(
160 *collection.current_version.read(),
161 &id,
162 RwLock::new(TransactionStatus::NotStarted {
163 last_updated: Utc::now(),
164 }),
165 );
166 Ok(Self {
167 id,
168 wal: WALFile::new()?,
169 })
170 }
171
172 pub fn pre_commit(
173 self,

Callers

nothing calls this directly

Calls 4

pre_commitMethod · 0.80
insertMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected