Skip to content

Commit

Permalink
chore(oci): pub utils::archive,unarchive, media types
Browse files Browse the repository at this point in the history
Signed-off-by: Vaughn Dice <[email protected]>
  • Loading branch information
vdice committed Oct 12, 2023
1 parent f9c553d commit 222a1b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
12 changes: 9 additions & 3 deletions crates/oci/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Spin's client for distributing applications via OCI registries

use std::path::{Path, PathBuf};

use anyhow::{bail, Context, Result};
Expand All @@ -24,10 +26,14 @@ use walkdir::WalkDir;
use crate::auth::AuthConfig;

// TODO: the media types for application, wasm module, data and archive layer are not final.
const SPIN_APPLICATION_MEDIA_TYPE: &str = "application/vnd.fermyon.spin.application.v1+config";
/// Media type for a layer representing a locked Spin application configuration
pub const SPIN_APPLICATION_MEDIA_TYPE: &str = "application/vnd.fermyon.spin.application.v1+config";
// Note: we hope to use a canonical value defined upstream for this media type
const WASM_LAYER_MEDIA_TYPE: &str = "application/vnd.wasm.content.layer.v1+wasm";
const DATA_MEDIATYPE: &str = "application/vnd.wasm.content.layer.v1+data";
const ARCHIVE_MEDIATYPE: &str = "application/vnd.wasm.content.bundle.v1.tar+gzip";
/// Media type for a layer representing a generic data file used by a Spin application
pub const DATA_MEDIATYPE: &str = "application/vnd.wasm.content.layer.v1+data";
/// Media type for a layer representing a compressed archive of one or more files used by a Spin application
pub const ARCHIVE_MEDIATYPE: &str = "application/vnd.wasm.content.bundle.v1.tar+gzip";

const CONFIG_FILE: &str = "config.json";
const LATEST_TAG: &str = "latest";
Expand Down
4 changes: 2 additions & 2 deletions crates/oci/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#![deny(missing_docs)]

mod auth;
mod client;
pub mod client;
mod loader;
mod utils;
pub mod utils;

pub use client::Client;
pub use loader::OciLoader;
Expand Down
2 changes: 2 additions & 0 deletions crates/oci/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Utilities related to distributing Spin apps via OCI registries

use anyhow::{Context, Result};
use async_compression::tokio::bufread::GzipDecoder;
use async_compression::tokio::write::GzipEncoder;
Expand Down

0 comments on commit 222a1b0

Please sign in to comment.