pub struct Journal { /* private fields */ }
Expand description
The journal records a stream of mutations that are to be applied to other objects. At mount time, these records can be replayed into memory. It provides a way to quickly persist changes without having to make a large number of writes; they can be deferred to a later time (e.g. when a sufficient number have been queued). It also provides support for transactions, the ability to have mutations that are to be applied atomically together.
Implementations§
Source§impl Journal
impl Journal
pub fn new(objects: Arc<ObjectManager>, options: JournalOptions) -> Journal
pub fn set_trace(&self, trace: bool)
pub fn set_image_builder_mode(&self, enabled: bool)
pub fn image_builder_mode(&self) -> bool
Sourcepub async fn replay(
&self,
filesystem: Arc<FxFilesystem>,
on_new_allocator: Option<Box<dyn Fn(Arc<Allocator>) + Send + Sync>>,
) -> Result<(), Error>
pub async fn replay( &self, filesystem: Arc<FxFilesystem>, on_new_allocator: Option<Box<dyn Fn(Arc<Allocator>) + Send + Sync>>, ) -> Result<(), Error>
Reads the latest super-block, and then replays journaled records.
Sourcepub async fn init_empty(
&self,
filesystem: Arc<FxFilesystem>,
) -> Result<(), Error>
pub async fn init_empty( &self, filesystem: Arc<FxFilesystem>, ) -> Result<(), Error>
Creates an empty filesystem with the minimum viable objects (including a root parent and root store but no further child stores).
Sourcepub async fn allocate_journal(&self) -> Result<(), Error>
pub async fn allocate_journal(&self) -> Result<(), Error>
Normally we allocate the journal when creating the filesystem. This is used image_builder_mode when journal allocation is done last.
pub async fn init_superblocks(&self) -> Result<(), Error>
Sourcepub async fn read_transactions_for_object(
&self,
object_id: u64,
) -> Result<Vec<JournaledTransaction>, Error>
pub async fn read_transactions_for_object( &self, object_id: u64, ) -> Result<Vec<JournaledTransaction>, Error>
Takes a snapshot of all journaled transactions which affect |object_id| since its last flush. The caller is responsible for locking; it must ensure that the journal is not trimmed during this call. For example, a Flush lock could be held on the object in question (assuming that object has data to flush and is registered with ObjectManager).
Sourcepub async fn commit(
&self,
transaction: &mut Transaction<'_>,
) -> Result<u64, Error>
pub async fn commit( &self, transaction: &mut Transaction<'_>, ) -> Result<u64, Error>
Commits a transaction. This is not thread safe; the caller must take appropriate locks.
Sourcepub async fn sync(
&self,
options: SyncOptions<'_>,
) -> Result<Option<(JournalCheckpoint, u64)>, Error>
pub async fn sync( &self, options: SyncOptions<'_>, ) -> Result<Option<(JournalCheckpoint, u64)>, Error>
Flushes any buffered journal data to the device. Note that this does not flush the device unless the flush_device option is set, in which case data should 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.
Sourcepub fn super_block_header(&self) -> SuperBlockHeader
pub fn super_block_header(&self) -> SuperBlockHeader
Returns a copy of the super-block header.
Sourcepub async fn check_journal_space(&self) -> Result<(), Error>
pub async fn check_journal_space(&self) -> Result<(), Error>
Waits for there to be sufficient space in the journal.
Sourcepub async fn flush_task(self: Arc<Self>)
pub async fn flush_task(self: Arc<Self>)
This task will flush journal data to the device when there is data that needs flushing, and trigger compactions when short of journal space. It will return after the terminate method has been called, or an error is encountered with either flushing or compaction.
Sourcepub async fn compact(&self) -> Result<(), Error>
pub async fn compact(&self) -> Result<(), Error>
This should generally NOT be called externally. It is public to allow use by FIDL service fxfs.Debug.
pub async fn stop_compactions(&self)
Sourcepub fn track_statistics(self: &Arc<Self>, parent: &Node, name: &str)
pub fn track_statistics(self: &Arc<Self>, parent: &Node, name: &str)
Creates a lazy inspect node named str
under parent
which will yield statistics for the
journal when queried.
Auto Trait Implementations§
impl !Freeze for Journal
impl !RefUnwindSafe for Journal
impl Send for Journal
impl Sync for Journal
impl Unpin for Journal
impl !UnwindSafe for Journal
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more