pub struct StateJournal {
pub environment: Option<Arc<EnvDescription>>,
/* private fields */
}Expand description
Writer managing the persistent state journal and its companion .cscdesc file.
Fields§
§environment: Option<Arc<EnvDescription>>Implementations§
Source§impl StateJournal
impl StateJournal
Sourcepub fn create_at_path(
journal_path: &Path,
desc_path: &Path,
sources: &[PathBuf],
destination: &Path,
) -> Result<Self>
pub fn create_at_path( journal_path: &Path, desc_path: &Path, sources: &[PathBuf], destination: &Path, ) -> Result<Self>
Creates a new state journal at the specified path. Fails with an error if either file already exists.
Sourcepub fn create_new(
home_dir: &Path,
sources: &[PathBuf],
destination: &Path,
) -> Result<Self>
pub fn create_new( home_dir: &Path, sources: &[PathBuf], destination: &Path, ) -> Result<Self>
Creates a new timestamped state journal directly in the user’s home directory. Fails with an error if either file already exists.
Sourcepub fn open_for_resume(
journal_path: &Path,
desc_path: &Path,
snapshot: &JournalSnapshot,
) -> Result<Self>
pub fn open_for_resume( journal_path: &Path, desc_path: &Path, snapshot: &JournalSnapshot, ) -> Result<Self>
Reopens a journal, preserving all committed bytes and completion markers.
Previously completed journals explicitly begin a new writable session.
Legacy journals (prior to CSCJRNL5 / DcMixed2) are rejected with an error.
Sourcepub fn set_defer_completion(&mut self, defer: bool)
pub fn set_defer_completion(&mut self, defer: bool)
Configures whether execute_copy_pipeline should defer marking the journal
completed (e.g., until source deletion finishes in a move operation).
Sourcepub const fn defer_completion(&self) -> bool
pub const fn defer_completion(&self) -> bool
Whether completion marking is deferred until post-copy move cleanup completes.
Sourcepub fn committed_entities(&self) -> &HashMap<Vec<u8>, FileEntity>
pub fn committed_entities(&self) -> &HashMap<Vec<u8>, FileEntity>
Read-only map of all committed entities in this journal session.
Sourcepub fn move_sources(&self) -> &HashMap<PathBuf, MoveSourceRecord>
pub fn move_sources(&self) -> &HashMap<PathBuf, MoveSourceRecord>
Read-only map of all durable move source inventory and disposition records.
Sourcepub fn record_move_source(&mut self, record: MoveSourceRecord)
pub fn record_move_source(&mut self, record: MoveSourceRecord)
Inserts or updates a move source inventory record in memory.
Sourcepub fn record_move_sources_durable(
&mut self,
records: impl IntoIterator<Item = MoveSourceRecord>,
) -> Result<()>
pub fn record_move_sources_durable( &mut self, records: impl IntoIterator<Item = MoveSourceRecord>, ) -> Result<()>
Inserts or updates move source inventory records and flushes .cscdesc durably.
Sourcepub fn update_move_source_disposition_durable(
&mut self,
source_path: &Path,
disposition: MoveSourceDisposition,
) -> Result<()>
pub fn update_move_source_disposition_durable( &mut self, source_path: &Path, disposition: MoveSourceDisposition, ) -> Result<()>
Updates the durable disposition of a move source entry and flushes .cscdesc durably.
Sourcepub fn committed_entity_for_move_source<'a>(
&'a self,
record: &MoveSourceRecord,
) -> Option<&'a FileEntity>
pub fn committed_entity_for_move_source<'a>( &'a self, record: &MoveSourceRecord, ) -> Option<&'a FileEntity>
Looks up the committed [FileEntity] corresponding to a MoveSourceRecord.
Sourcepub fn record_applied_directory(
&mut self,
relative: PathBuf,
identity: InodeKey,
)
pub fn record_applied_directory( &mut self, relative: PathBuf, identity: InodeKey, )
Records an applied destination directory identity receipt for crash recovery.
Sourcepub fn applied_directories(&self) -> &HashMap<PathBuf, InodeKey>
pub fn applied_directories(&self) -> &HashMap<PathBuf, InodeKey>
Read-only map of all applied destination directory identity receipts.
Sourcepub fn record_noatime_used(&mut self, used: bool)
pub fn record_noatime_used(&mut self, used: bool)
Records whether O_NOATIME was successfully used for payload operations.
Sourcepub const fn noatime_used(&self) -> bool
pub const fn noatime_used(&self) -> bool
Whether O_NOATIME was used during this journal session.
Sourcepub fn record_entity(&mut self, entity: &FileEntity)
pub fn record_entity(&mut self, entity: &FileEntity)
Queues a FileEntity for transactional commit.
In copy mode, stream payloads are stripped so that .cscjournal records
only stream metadata and checksums rather than duplicating stream bodies.
A poisoned or completed writer retains the item; the next commit fails.
Sourcepub fn commit_batch(&mut self) -> Result<()>
pub fn commit_batch(&mut self) -> Result<()>
Commits all pending items to disk with an explicit fsync, advancing the transaction.
Sourcepub fn mark_completed(&mut self) -> Result<()>
pub fn mark_completed(&mut self) -> Result<()>
Marks the job as completely finished and updates the .cscdesc companion file.
Sourcepub fn record_error(&mut self, error: &JournalErrorRecord) -> Result<()>
pub fn record_error(&mut self, error: &JournalErrorRecord) -> Result<()>
Records an item or operational error directly into the state journal and descriptor.
Sourcepub fn record_warning(&mut self, code: &str, message: &str) -> Result<()>
pub fn record_warning(&mut self, code: &str, message: &str) -> Result<()>
Records a caveat or operational warning directly into the state journal and descriptor.
Sourcepub fn mark_failed(&mut self, reason: &str) -> Result<()>
pub fn mark_failed(&mut self, reason: &str) -> Result<()>
Marks the job as failed with a specified reason and updates .cscdesc.
Sourcepub fn pending_descriptor_status(&self) -> Option<&str>
pub fn pending_descriptor_status(&self) -> Option<&str>
Returns the descriptor status awaiting metadata-only repair.
Sourcepub fn retry_descriptor(&mut self) -> Result<()>
pub fn retry_descriptor(&mut self) -> Result<()>
Retries only a pending descriptor update, without writing journal bytes. Failure retains the pending status and blocks further journal writes. Success does not reopen a completed writer or permit duplicate completion.
Sourcepub fn errors(&self) -> &[JournalErrorRecord]
pub fn errors(&self) -> &[JournalErrorRecord]
Slice of all errors recorded during this journal session.
Sourcepub fn warnings(&self) -> &[JournalWarningRecord]
pub fn warnings(&self) -> &[JournalWarningRecord]
Slice of all warnings and caveats recorded during this journal session.
pub fn journal_path(&self) -> &Path
pub fn desc_path(&self) -> &Path
pub fn destination(&self) -> &Path
pub fn snapshot(&self) -> Option<&JournalSnapshot>
Sourcepub fn materialized_path_for(&self, source_rel: &Path) -> Option<PathBuf>
pub fn materialized_path_for(&self, source_rel: &Path) -> Option<PathBuf>
Returns the actual relative path where source_rel was materialized on disk,
checking uncommitted records first and then any loaded journal snapshot.
Auto Trait Implementations§
impl Freeze for StateJournal
impl !RefUnwindSafe for StateJournal
impl Send for StateJournal
impl Sync for StateJournal
impl Unpin for StateJournal
impl !UnwindSafe for StateJournal
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
fn exact_from(value: T) -> U
§impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
fn exact_into(self) -> U
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
fn overflowing_into(self) -> (U, bool)
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);