MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / observed_index_row

Function observed_index_row

atomic-repository/src/change_source/scan.rs:775–811  ·  view source on GitHub ↗
(
    file: &ObservedFile,
    content_id: Hash,
    mode: u16,
    kind: InodeKind,
    racy_after: FileIndexTimestamp,
    conversion_policy: Hash,
)

Source from the content-addressed store, hash-verified

773}
774
775fn observed_index_row(
776 file: &ObservedFile,
777 content_id: Hash,
778 mode: u16,
779 kind: InodeKind,
780 racy_after: FileIndexTimestamp,
781 conversion_policy: Hash,
782) -> Result<FileIndexV2Entry, ChangeSourceError> {
783 FileIndexV2Entry::complete(
784 file.device.ok_or_else(|| ChangeSourceError::InvalidIndex {
785 path: file.native_path.display().to_string(),
786 message: "device identity unavailable".into(),
787 })?,
788 file.inode.ok_or_else(|| ChangeSourceError::InvalidIndex {
789 path: file.native_path.display().to_string(),
790 message: "inode identity unavailable".into(),
791 })?,
792 file.mtime.ok_or_else(|| ChangeSourceError::InvalidIndex {
793 path: file.native_path.display().to_string(),
794 message: "mtime unavailable".into(),
795 })?,
796 file.ctime.ok_or_else(|| ChangeSourceError::InvalidIndex {
797 path: file.native_path.display().to_string(),
798 message: "ctime unavailable".into(),
799 })?,
800 file.size,
801 content_id,
802 mode,
803 kind,
804 racy_after,
805 conversion_policy,
806 )
807 .map_err(|error| ChangeSourceError::InvalidIndex {
808 path: file.native_path.display().to_string(),
809 message: error.to_string(),
810 })
811}
812
813#[cfg(unix)]
814fn observe_metadata(native_path: std::path::PathBuf, metadata: &fs::Metadata) -> ObservedFile {

Callers 2

omission_lease_matchesFunction · 0.85

Calls 1

displayMethod · 0.80

Tested by

no test coverage detected