| 115 | impl FileIndexV2Entry { |
| 116 | #[allow(clippy::too_many_arguments)] |
| 117 | pub fn complete( |
| 118 | device: u64, |
| 119 | inode: u64, |
| 120 | mtime: FileIndexTimestamp, |
| 121 | ctime: FileIndexTimestamp, |
| 122 | size: u64, |
| 123 | content_id: Hash, |
| 124 | canonical_mode: u16, |
| 125 | canonical_kind: InodeKind, |
| 126 | racy_after: FileIndexTimestamp, |
| 127 | conversion_policy: Hash, |
| 128 | ) -> PristineResult<Self> { |
| 129 | if canonical_mode > 0o777 { |
| 130 | return Err(codec_error(format!( |
| 131 | "FILE_INDEX_V2 canonical mode {canonical_mode:#o} contains unsupported bits" |
| 132 | ))); |
| 133 | } |
| 134 | Ok(Self { |
| 135 | fields: FileIndexV2Fields::ALL, |
| 136 | device: Some(device), |
| 137 | inode: Some(inode), |
| 138 | mtime: Some(mtime), |
| 139 | ctime: Some(ctime), |
| 140 | size: Some(size), |
| 141 | content_id: Some(content_id), |
| 142 | canonical_mode: Some(canonical_mode), |
| 143 | canonical_kind: Some(canonical_kind), |
| 144 | racy_after: Some(racy_after), |
| 145 | conversion_policy: Some(conversion_policy), |
| 146 | }) |
| 147 | } |
| 148 | |
| 149 | pub fn is_complete(&self) -> bool { |
| 150 | self.fields == FileIndexV2Fields::ALL |