-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
Showing
33 changed files
with
1,499 additions
and
1,163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use anyhow::Result; | ||
use clap::{Parser, ValueEnum}; | ||
use krata::v1::{ | ||
common::GuestOciImageFormat, | ||
control::{control_service_client::ControlServiceClient, PullImageRequest}, | ||
}; | ||
|
||
use tonic::transport::Channel; | ||
|
||
use crate::pull::pull_interactive_progress; | ||
|
||
#[derive(ValueEnum, Clone, Debug, PartialEq, Eq)] | ||
pub enum PullImageFormat { | ||
Squashfs, | ||
Erofs, | ||
} | ||
|
||
#[derive(Parser)] | ||
#[command(about = "Pull an image into the cache")] | ||
pub struct PullCommand { | ||
#[arg(help = "Image name")] | ||
image: String, | ||
#[arg(short = 's', long, default_value = "squashfs", help = "Image format")] | ||
image_format: PullImageFormat, | ||
} | ||
|
||
impl PullCommand { | ||
pub async fn run(self, mut client: ControlServiceClient<Channel>) -> Result<()> { | ||
let response = client | ||
.pull_image(PullImageRequest { | ||
image: self.image.clone(), | ||
format: match self.image_format { | ||
PullImageFormat::Squashfs => GuestOciImageFormat::Squashfs.into(), | ||
PullImageFormat::Erofs => GuestOciImageFormat::Erofs.into(), | ||
}, | ||
}) | ||
.await?; | ||
let reply = pull_interactive_progress(response.into_inner()).await?; | ||
println!("{}", reply.digest); | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ pub mod cli; | |
pub mod console; | ||
pub mod format; | ||
pub mod metrics; | ||
pub mod pull; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.