Write a manifest file and return its metadata.
(
&self,
file_io: &FileIO,
path: &str,
file_name: &str,
entries: &[ManifestEntry],
)
| 469 | |
| 470 | /// Write a manifest file and return its metadata. |
| 471 | async fn write_manifest_file( |
| 472 | &self, |
| 473 | file_io: &FileIO, |
| 474 | path: &str, |
| 475 | file_name: &str, |
| 476 | entries: &[ManifestEntry], |
| 477 | ) -> Result<ManifestFileMeta> { |
| 478 | Manifest::write(file_io, path, entries).await?; |
| 479 | |
| 480 | let mut added_file_count: i64 = 0; |
| 481 | let mut deleted_file_count: i64 = 0; |
| 482 | for entry in entries { |
| 483 | match entry.kind() { |
| 484 | FileKind::Add => added_file_count += 1, |
| 485 | FileKind::Delete => deleted_file_count += 1, |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | // Get file size |
| 490 | let status = file_io.get_status(path).await?; |
| 491 | |
| 492 | let partition_stats = self.compute_partition_stats(entries)?; |
| 493 | |
| 494 | Ok(ManifestFileMeta::new( |
| 495 | file_name.to_string(), |
| 496 | status.size as i64, |
| 497 | added_file_count, |
| 498 | deleted_file_count, |
| 499 | partition_stats, |
| 500 | self.table.schema().id(), |
| 501 | )) |
| 502 | } |
| 503 | |
| 504 | /// Check if this commit was already completed (idempotency). |
| 505 | async fn is_duplicate_commit( |
no test coverage detected