mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-04 05:31:32 +00:00
feat: oci compliance work (#85)
* chore: rework oci crate to be more composable * feat: image pull is now internally explicit * feat: utilize vfs for assembling oci images * feat: rework oci to preserve permissions via a vfs
This commit is contained in:
58
crates/oci/src/packer/mod.rs
Normal file
58
crates/oci/src/packer/mod.rs
Normal file
@ -0,0 +1,58 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use self::backend::OciPackerBackendType;
|
||||
use oci_spec::image::{ImageConfiguration, ImageManifest};
|
||||
|
||||
pub mod backend;
|
||||
pub mod cache;
|
||||
pub mod service;
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy)]
|
||||
pub enum OciPackedFormat {
|
||||
#[default]
|
||||
Squashfs,
|
||||
Erofs,
|
||||
}
|
||||
|
||||
impl OciPackedFormat {
|
||||
pub fn extension(&self) -> &str {
|
||||
match self {
|
||||
OciPackedFormat::Squashfs => "squashfs",
|
||||
OciPackedFormat::Erofs => "erofs",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn backend(&self) -> OciPackerBackendType {
|
||||
match self {
|
||||
OciPackedFormat::Squashfs => OciPackerBackendType::MkSquashfs,
|
||||
OciPackedFormat::Erofs => OciPackerBackendType::MkfsErofs,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct OciImagePacked {
|
||||
pub digest: String,
|
||||
pub path: PathBuf,
|
||||
pub format: OciPackedFormat,
|
||||
pub config: ImageConfiguration,
|
||||
pub manifest: ImageManifest,
|
||||
}
|
||||
|
||||
impl OciImagePacked {
|
||||
pub fn new(
|
||||
digest: String,
|
||||
path: PathBuf,
|
||||
format: OciPackedFormat,
|
||||
config: ImageConfiguration,
|
||||
manifest: ImageManifest,
|
||||
) -> OciImagePacked {
|
||||
OciImagePacked {
|
||||
digest,
|
||||
path,
|
||||
format,
|
||||
config,
|
||||
manifest,
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user