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

Method seal

atomic-repository/src/repository/sandbox.rs:330–358  ·  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

328 /// Provenance (view name and Merkle state) is recorded in the manifest
329 /// annotations. Returns the manifest digest and file count.
330 pub fn seal(&self, opts: SealOptions) -> Result<SealResult, RepositoryError> {
331 let work_dir = tempfile::tempdir()?;
332 let files = self.materialize_view_to(&opts.view, work_dir.path())?;
333 let layer = oci::layer_from_dir(work_dir.path())?;
334
335 let view_info = self.get_view_info(&opts.view)?;
336 let mut annotations = BTreeMap::new();
337 annotations.insert("org.atomic.view".to_string(), opts.view.clone());
338 annotations.insert(
339 "org.atomic.view-merkle".to_string(),
340 view_info.state_base32(),
341 );
342
343 let config = OciImageConfig {
344 architecture: oci::host_arch(),
345 os: "linux".to_string(),
346 env: opts.env.clone(),
347 entrypoint: opts.entrypoint.clone(),
348 annotations,
349 };
350
351 let manifest_digest = oci::write_image_layout(&opts.out, &[layer], &config)?;
352
353 Ok(SealResult {
354 manifest_digest,
355 files,
356 out: opts.out,
357 })
358 }
359}
360
361/// 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