/// Flushes any buffered journal data to the device.  Note that this does not flush the device
/// so it still does not guarantee data will have been persisted to lower layers.  If a
/// precondition is supplied, it is evaluated and the sync will be skipped if it returns false.
/// This allows callers to check a condition whilst a lock is held.  If a sync is performed,
/// this function returns the checkpoint that was flushed and the amount of borrowed metadata
/// space at the point it was flushed.
Flushes any buffered journal data to the device.  Note that this does not flush the device
so it still does not guarantee data will have been persisted to lower layers.  If a
precondition is supplied, it is evaluated and the sync will be skipped if it returns false.
This allows callers to check a condition whilst a lock is held.  If a sync is performed,
this function returns the checkpoint that was flushed and the amount of borrowed metadata
space at the point it was flushed.
Flushes any buffered journal data to the device . Note that this does not flush the device so it still does not guarantee data will have been persisted to lower layers . If a precondition is supplied it is evaluated and the sync will be skipped if it returns false . This allows callers to check a condition whilst a lock is held . If a sync is performed this function returns the checkpoint that was flushed and the amount of borrowed metadata space at the point it was flushed .
pub async fn sync(
        &self,
        options: SyncOptions<'_>,
    ) -> Result<Option<(JournalCheckpoint, u64)>, Error> {
        let _guard = debug_assert_not_too_long!(self.sync_mutex.lock());
        let (checkpoint, borrowed) = {
            if let Some(precondition) = options.precondition {
                if !precondition() {
                    return Ok(None);
                }
            }
            // This guard is required so that we don't insert an EndBlock record in the middle of a
            // transaction.
            let _guard = debug_assert_not_too_long!(self.writer_mutex.lock());
            self.pad_to_block()?
        };
        if options.flush_device {
            self.flush_device(checkpoint.file_offset).await?;
        }
        Ok(Some((checkpoint, borrowed)))
    }
pub async fn sync ( & self , options : SyncOptions < ' _ > , ) -> Result < Option < ( JournalCheckpoint , u64 ) > , Error > { let _guard = debug_assert_not_too_long ! ( self sync_mutex lock ( ) ) ; let ( checkpoint , borrowed ) = { if let Some ( precondition ) = options . precondition { if ! precondition ( ) { return Ok ( None ) ; } } // This guard is required so that we don't insert an EndBlock record in the middle of a // transaction. let _guard = debug_assert_not_too_long ! ( self writer_mutex lock ( ) ) ; self . pad_to_block ( ) ? } ; if options . flush_device { self . flush_device ( checkpoint . file_offset ) . await ? ; } Ok ( Some ( ( checkpoint , borrowed ) ) ) }
Flushes any buffered journal data to the device.
Flushes any buffered journal data to the device .
&self
options
SyncOptions<'_>