Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the type of size to be u64 #203

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ use oci_spec::image::{

let config = DescriptorBuilder::default()
.media_type(MediaType::ImageConfig)
.size(7023)
.size(7023u64)
.digest("sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7")
.build()
.expect("build config descriptor");

let layers: Vec<Descriptor> = [
(
32654,
32654u64,
"sha256:9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0",
),
(
Expand Down
4 changes: 2 additions & 2 deletions src/image/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ mod tests {
fn create_manifest() -> ArtifactManifest {
let blob = DescriptorBuilder::default()
.media_type(MediaType::Other("application/gzip".to_string()))
.size(123)
.size(123u64)
.digest(
"sha256:87923725d74f4bfb94c9e86d64170f7521aad8221a5de834851470ca142da630"
.to_string(),
Expand All @@ -235,7 +235,7 @@ mod tests {
.unwrap();
let subject = DescriptorBuilder::default()
.media_type(MediaType::ImageManifest)
.size(1234)
.size(1234u64)
.digest(
"sha256:cc06a2839488b8bd2a2b99dcdc03d5cfd818eed72ad08ef3cc197aac64c0d0a0"
.to_string(),
Expand Down
4 changes: 2 additions & 2 deletions src/image/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct Descriptor {
/// length of the retrieved content does not match the specified
/// length, the content SHOULD NOT be trusted.
#[getset(get_copy = "pub", set = "pub")]
size: i64,
size: u64,
/// This OPTIONAL property specifies a list of URIs from which this
/// object MAY be downloaded. Each entry MUST conform to [RFC 3986](https://tools.ietf.org/html/rfc3986).
/// Entries SHOULD use the http and https schemes, as defined
Expand Down Expand Up @@ -133,7 +133,7 @@ pub struct Platform {

impl Descriptor {
/// Construct a new descriptor with the required fields.
pub fn new(media_type: MediaType, size: i64, digest: impl Into<String>) -> Self {
pub fn new(media_type: MediaType, size: u64, digest: impl Into<String>) -> Self {
Self {
media_type,
size,
Expand Down
4 changes: 2 additions & 2 deletions src/image/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ mod tests {
let ppc_manifest = DescriptorBuilder::default()
.media_type(MediaType::ImageManifest)
.digest("sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f")
.size(7143)
.size(7143u64)
.platform(
PlatformBuilder::default()
.architecture(Arch::PowerPC64le)
Expand All @@ -253,7 +253,7 @@ mod tests {
let amd64_manifest = DescriptorBuilder::default()
.media_type(MediaType::ImageManifest)
.digest("sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270")
.size(7682)
.size(7682u64)
.platform(
PlatformBuilder::default()
.architecture(Arch::Amd64)
Expand Down
4 changes: 2 additions & 2 deletions src/image/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ mod tests {

let config = DescriptorBuilder::default()
.media_type(MediaType::ImageConfig)
.size(7023)
.size(7023u64)
.digest("sha256:b5b2b2c507a0944348e0303114d8d93aaaa081732b86451d9bce1f432a537bc7")
.build()
.expect("build config descriptor");

let layers: Vec<Descriptor> = [
(
32654,
32654u64,
"sha256:9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0",
),
(
Expand Down
Loading