Skip to content

Commit

Permalink
Merge pull request #25 from containers/update-for-semver
Browse files Browse the repository at this point in the history
lib: Drop deprecated `write_json_blob` global
  • Loading branch information
ariel-miculas authored Sep 30, 2024
2 parents 0738d7e + e9680ac commit fbfffd2
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,6 @@ pub struct OciDir {
blobs_dir: Dir,
}

/// Write a serializable data (JSON) as an OCI blob
#[deprecated = "Use OciDir::write_json_blob instead"]
pub fn write_json_blob<S: serde::Serialize>(
ocidir: &Dir,
v: &S,
media_type: oci_image::MediaType,
) -> Result<oci_image::DescriptorBuilder> {
let mut w = BlobWriter::new(ocidir)?;
let mut ser = serde_json::Serializer::with_formatter(&mut w, CanonicalFormatter::new());
v.serialize(&mut ser)?;
let blob = w.complete()?;
Ok(blob.descriptor().media_type(media_type))
}

/// Create a dummy config descriptor.
/// Our API right now always mutates a manifest, which means we need
/// a "valid" manifest, which requires a "valid" config descriptor.
Expand Down Expand Up @@ -263,10 +249,11 @@ impl OciDir {
v: &S,
media_type: oci_image::MediaType,
) -> Result<oci_image::DescriptorBuilder> {
// Forward to the legacy implementation; TODO semver for 0.3, drop
// the legacy API and move it here.
#[allow(deprecated)]
write_json_blob(&self.dir, v, media_type)
let mut w = BlobWriter::new(&self.dir)?;
let mut ser = serde_json::Serializer::with_formatter(&mut w, CanonicalFormatter::new());
v.serialize(&mut ser)?;
let blob = w.complete()?;
Ok(blob.descriptor().media_type(media_type))
}

/// Create a blob (can be anything).
Expand Down

0 comments on commit fbfffd2

Please sign in to comment.