pub struct AtomicBatch { /* private fields */ }Expand description
Manages a two-phase atomic commit of multiple file writes.
Implementations§
Source§impl AtomicBatch
impl AtomicBatch
Sourcepub fn new(
targets: &[PathBuf],
backup_enabled: bool,
interrupted: Arc<AtomicBool>,
) -> Result<Self>
pub fn new( targets: &[PathBuf], backup_enabled: bool, interrupted: Arc<AtomicBool>, ) -> Result<Self>
Create a new atomic batch. Acquires the lock file immediately.
targets is used to determine the journal directory.
backup_enabled controls whether hard-link backups are created.
interrupted is an AtomicBool set by signal handlers.
Sourcepub fn stage(
&mut self,
target_path: &Path,
content: &[u8],
_encoding: &str,
) -> Result<()>
pub fn stage( &mut self, target_path: &Path, content: &[u8], _encoding: &str, ) -> Result<()>
Stage a single file write: write content to a temp file in the same directory as the target, fsync it, then release the fd.
Sourcepub fn warn_if_large_batch(&self)
pub fn warn_if_large_batch(&self)
Emit a warning if the batch size exceeds the threshold.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AtomicBatch
impl RefUnwindSafe for AtomicBatch
impl Send for AtomicBatch
impl Sync for AtomicBatch
impl Unpin for AtomicBatch
impl UnsafeUnpin for AtomicBatch
impl UnwindSafe for AtomicBatch
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