pub trait OperationImpl {
// Required methods
fn direction(&self) -> Direction;
fn contains_file(
&self,
pile_name: &PileName,
rel_path: &RelativePath,
only_modified: bool
) -> bool;
fn timestamp(&self) -> OffsetDateTime;
fn hoard_name(&self) -> &HoardName;
fn checksum_for(
&self,
pile_name: &PileName,
rel_path: &RelativePath
) -> Option<Checksum>;
fn all_files_with_checksums<'a>(
&'a self
) -> Box<dyn Iterator<Item = OperationFileInfo> + 'a>;
// Provided methods
fn hoard_operations_iter<'a>(
&'a self,
_hoard_path: &HoardPath,
_hoard: &Hoard
) -> Result<Box<dyn Iterator<Item = ItemOperation<HoardItem>> + 'a>, Error> { ... }
fn file_operation(
&self,
_pile_name: &PileName,
_rel_path: &RelativePath
) -> Result<Option<OperationType>, Error> { ... }
}
Expand description
Functions that must be implemented by all operation log versions.
Required Methods§
sourcefn contains_file(
&self,
pile_name: &PileName,
rel_path: &RelativePath,
only_modified: bool
) -> bool
fn contains_file( &self, pile_name: &PileName, rel_path: &RelativePath, only_modified: bool ) -> bool
Whether the operation log contains the given file by pile name and relative path.
sourcefn timestamp(&self) -> OffsetDateTime
fn timestamp(&self) -> OffsetDateTime
The timestamp for the logged operation.
sourcefn hoard_name(&self) -> &HoardName
fn hoard_name(&self) -> &HoardName
The associated hoard name for this operation.
sourcefn checksum_for(
&self,
pile_name: &PileName,
rel_path: &RelativePath
) -> Option<Checksum>
fn checksum_for( &self, pile_name: &PileName, rel_path: &RelativePath ) -> Option<Checksum>
The checksum associated with the given file, or None
if the file does not exist or was
deleted.
sourcefn all_files_with_checksums<'a>(
&'a self
) -> Box<dyn Iterator<Item = OperationFileInfo> + 'a>
fn all_files_with_checksums<'a>( &'a self ) -> Box<dyn Iterator<Item = OperationFileInfo> + 'a>
An iterator over all files that exist within this operation log, not including any that were deleted.
Provided Methods§
sourcefn hoard_operations_iter<'a>(
&'a self,
_hoard_path: &HoardPath,
_hoard: &Hoard
) -> Result<Box<dyn Iterator<Item = ItemOperation<HoardItem>> + 'a>, Error>
fn hoard_operations_iter<'a>( &'a self, _hoard_path: &HoardPath, _hoard: &Hoard ) -> Result<Box<dyn Iterator<Item = ItemOperation<HoardItem>> + 'a>, Error>
Returns an iterator of the file operations represented by this operation object.
Errors
Returns Error::UpgradeRequired
if the operation version is too old to support this
function.
sourcefn file_operation(
&self,
_pile_name: &PileName,
_rel_path: &RelativePath
) -> Result<Option<OperationType>, Error>
fn file_operation( &self, _pile_name: &PileName, _rel_path: &RelativePath ) -> Result<Option<OperationType>, Error>
Returns the operation performed on the given file, if any.
Returns None
if the file did not exist in the hoard or if the file was unmodified.
Errors
Returns Error::UpgradeRequired
in the case when the operation log format is too old to
contain information about the operation performed on a given file.