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

Method seal

atomic-repository/src/repository/sandbox.rs:309–337  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 2

runMethod · 0.80

Calls 9

layer_from_dirFunction · 0.85
host_archFunction · 0.85
write_image_layoutFunction · 0.85
materialize_view_toMethod · 0.80
get_view_infoMethod · 0.80
state_base32Method · 0.80
pathMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45

Tested by 1