pub struct ChargedFileWriter { /* private fields */ }Expand description
Buffered writer to a temp sibling file. Explicit close fsyncs and
atomically renames it onto final_path; Drop (the safety net for an un-closed
writer) discards the temp file without renaming, removing it only while its name
still refers to the writer’s file.
Implementations§
Source§impl ChargedFileWriter
impl ChargedFileWriter
pub fn new( file: File, temp: TempFile, final_path: ContentPath, limits: &TenantLimits, quota: Option<Arc<DiskQuota>>, ) -> Result<Self, MemoryCapExceeded>
pub fn write_line(&mut self, line: &str) -> Result<(), WriteError>
pub fn write_bytes(&mut self, bytes: &[u8]) -> Result<(), WriteError>
Sourcepub fn close(&mut self) -> Result<(), WriteError>
pub fn close(&mut self) -> Result<(), WriteError>
Flush, fsync, and atomically rename temp→final. Idempotent: a second call after a successful close is a no-op.
Trait Implementations§
Source§impl Drop for ChargedFileWriter
impl Drop for ChargedFileWriter
Auto Trait Implementations§
impl Freeze for ChargedFileWriter
impl RefUnwindSafe for ChargedFileWriter
impl Send for ChargedFileWriter
impl Sync for ChargedFileWriter
impl Unpin for ChargedFileWriter
impl UnsafeUnpin for ChargedFileWriter
impl UnwindSafe for ChargedFileWriter
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