pub struct Transaction { /* private fields */ }Expand description
In-memory plan bound to one notebook. Drop discards; no begin/rollback.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub async fn commit(self) -> Result<CommitOutcome, NbError>
pub async fn commit(self) -> Result<CommitOutcome, NbError>
Validate-all, apply-all, at most one Git checkpoint.
Source§impl Transaction
impl Transaction
pub fn add_note( &mut self, path: &str, title: Option<&str>, content: &str, tags: &[String], ) -> Result<(), NbError>
pub fn add_todo( &mut self, path: &str, title: &str, description: Option<&str>, tasks: &[String], tags: &[String], ) -> Result<(), NbError>
pub fn add_bookmark( &mut self, path: &str, url: &str, title: Option<&str>, tags: &[String], comment: Option<&str>, ) -> Result<(), NbError>
pub fn add_folder(&mut self, path: &str) -> Result<(), NbError>
pub fn delete_note(&mut self, target: NoteTarget) -> Result<(), NbError>
Sourcepub fn delete_folder(
&mut self,
target: NoteTarget,
recursive: bool,
) -> Result<(), NbError>
pub fn delete_folder( &mut self, target: NoteTarget, recursive: bool, ) -> Result<(), NbError>
Delete a folder. recursive = false refuses non-empty folders,
listing their contents; recursive = true removes the whole
subtree. Marker files (.gitkeep) and .index files alone do
not count as contents.
pub fn move_note( &mut self, target: NoteTarget, destination: &str, ) -> Result<(), NbError>
pub fn mark_task_done( &mut self, target: NoteTarget, task_number: Option<u32>, ) -> Result<(), NbError>
pub fn unmark_task_done( &mut self, target: NoteTarget, task_number: Option<u32>, ) -> Result<(), NbError>
pub fn replace_note_body( &mut self, target: NoteTarget, new_body: &str, fingerprint: Fingerprint, ) -> Result<(), NbError>
pub fn edit_note_substring( &mut self, target: NoteTarget, pattern: &str, replacement: &str, occurrence: Occurrence, expected_count: u32, fingerprint: Option<Fingerprint>, ) -> Result<(), NbError>
pub fn edit_note_lines( &mut self, target: NoteTarget, edits: Vec<LineEdit>, ) -> Result<(), NbError>
pub fn retitle_note( &mut self, target: NoteTarget, title: &str, ) -> Result<(), NbError>
Sourcepub fn assert_revision(&mut self, expected: &str) -> Result<(), NbError>
pub fn assert_revision(&mut self, expected: &str) -> Result<(), NbError>
Assert the notebook revision is unchanged since capture.
Composable optimistic-concurrency precondition: evaluated at
commit time, before any materialization, so a mismatch
refuses cleanly with nothing applied. Capture the expected
revision with [crate::git::git_rev_parse_in]
(&["HEAD"]) at the moment the plan’s assumptions are
taken, and push this op into the same Transaction.
Auto Trait Implementations§
impl Forget for Transaction
impl Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin for Transaction
impl UnwindSafe for Transaction
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
Mutably borrows from an owned value. Read more