MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / write_txn

Method write_txn

atomic-core/src/pristine/txn/pristine.rs:351–365  ·  view source on GitHub ↗

Begin a read-write transaction Only one write transaction can be active at a time. The transaction must be explicitly committed with `commit()` or it will be rolled back when dropped.

(&self)

Source from the content-addressed store, hash-verified

349 /// must be explicitly committed with `commit()` or it will be rolled back
350 /// when dropped.
351 pub fn write_txn(&self) -> PristineResult<WriteTxn<'_>> {
352 let PristineDatabase::Writable(db) = &self.db else {
353 return Err(PristineError::Io(std::io::Error::new(
354 std::io::ErrorKind::PermissionDenied,
355 "cannot write through a read-only pristine handle",
356 )));
357 };
358 let txn = db.begin_write()?;
359 Ok(WriteTxn::new(
360 txn,
361 &self.next_node_id,
362 &self.next_view_id,
363 &self.next_inode,
364 ))
365 }
366
367 /// Allocate a new node ID
368 ///

Calls

no outgoing calls