Produce a single-layer (flattened) OCI image of the full merged state of `view`. Because a draft view sees its entire parent chain, the materialized content is the complete, self-contained rootfs — a deployable runtime. Provenance (view name and Merkle state) is recorded in the manifest annotations. Returns the manifest digest and file count.
(&self, opts: SealOptions)
| 571 | /// Provenance (view name and Merkle state) is recorded in the manifest |
| 572 | /// annotations. Returns the manifest digest and file count. |
| 573 | pub fn seal(&self, opts: SealOptions) -> Result<SealResult, RepositoryError> { |
| 574 | let materialized = self.materialized_view_files(&opts.view)?; |
| 575 | let files = materialized.len(); |
| 576 | let work_dir = tempfile::tempdir()?; |
| 577 | Self::write_materialized_files(work_dir.path(), &materialized)?; |
| 578 | let layer = oci::layer_from_dir(work_dir.path())?; |
| 579 | |
| 580 | let view_info = self.get_view_info(&opts.view)?; |
| 581 | let mut annotations = BTreeMap::new(); |
| 582 | annotations.insert("org.atomic.view".to_string(), opts.view.clone()); |
| 583 | annotations.insert( |
| 584 | "org.atomic.view-merkle".to_string(), |
| 585 | view_info.state_base32(), |
| 586 | ); |
| 587 | |
| 588 | let config = OciImageConfig { |
| 589 | architecture: oci::host_arch(), |
| 590 | os: "linux".to_string(), |
| 591 | env: opts.env.clone(), |
| 592 | entrypoint: opts.entrypoint.clone(), |
| 593 | annotations, |
| 594 | }; |
| 595 | |
| 596 | let manifest_digest = oci::write_image_layout(&opts.out, &[layer], &config)?; |
| 597 | |
| 598 | Ok(SealResult { |
| 599 | manifest_digest, |
| 600 | files, |
| 601 | out: opts.out, |
| 602 | }) |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | /// Clone a working tree from `src` to `dest`, one file at a time, reflinking |