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)
| 307 | /// Provenance (view name and Merkle state) is recorded in the manifest |
| 308 | /// annotations. Returns the manifest digest and file count. |
| 309 | pub fn seal(&self, opts: SealOptions) -> Result<SealResult, RepositoryError> { |
| 310 | let work_dir = tempfile::tempdir()?; |
| 311 | let files = self.materialize_view_to(&opts.view, work_dir.path())?; |
| 312 | let layer = oci::layer_from_dir(work_dir.path())?; |
| 313 | |
| 314 | let view_info = self.get_view_info(&opts.view)?; |
| 315 | let mut annotations = BTreeMap::new(); |
| 316 | annotations.insert("org.atomic.view".to_string(), opts.view.clone()); |
| 317 | annotations.insert( |
| 318 | "org.atomic.view-merkle".to_string(), |
| 319 | view_info.state_base32(), |
| 320 | ); |
| 321 | |
| 322 | let config = OciImageConfig { |
| 323 | architecture: oci::host_arch(), |
| 324 | os: "linux".to_string(), |
| 325 | env: opts.env.clone(), |
| 326 | entrypoint: opts.entrypoint.clone(), |
| 327 | annotations, |
| 328 | }; |
| 329 | |
| 330 | let manifest_digest = oci::write_image_layout(&opts.out, &[layer], &config)?; |
| 331 | |
| 332 | Ok(SealResult { |
| 333 | manifest_digest, |
| 334 | files, |
| 335 | out: opts.out, |
| 336 | }) |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | /// Clone a working tree from `src` to `dest`, one file at a time, reflinking |