Regc.Mutate.Layer (regc v0.0.2)

View Source

Cross-document layer removal and rebasing.

These functions keep image-manifest layers, config rootfs.diff_ids, and non-empty history entries aligned. Rebasing verifies that the declared old base is an exact prefix of the image before replacing it.

Summary

Functions

Replaces an exact old-base prefix with a new image base.

Removes a zero-based layer and its corresponding diff ID/history entry.

Removes every non-empty history layer whose created_by value matches a regular expression.

Functions

rebase(mutation, old_base, new_base, opts \\ [])

Replaces an exact old-base prefix with a new image base.

old_base and new_base may be mutation states or finalized mutation results and must include exact config bodies. The operation verifies layer descriptors, diff IDs, and full history prefixes before changing the image.

If the image already contains org.opencontainers.image.base.digest, it is updated to the new base manifest digest. :base_name and :base_digest may explicitly set both OCI base annotations.

remove(mutation, index)

@spec remove(Regc.Mutate.Image.t(), non_neg_integer()) ::
  {:ok, Regc.Mutate.Image.t()} | {:error, Regc.Error.t()}

Removes a zero-based layer and its corresponding diff ID/history entry.

remove_by_created_by(mutation, expression)

@spec remove_by_created_by(Regc.Mutate.Image.t(), Regex.t()) ::
  {:ok, Regc.Mutate.Image.t()} | {:error, Regc.Error.t()}

Removes every non-empty history layer whose created_by value matches a regular expression.