use std::ops::RangeBounds;
use async_trait::async_trait;
use bytes::Bytes;
use futures::stream::BoxStream;
use oci_spec::image::{Digest, ImageConfiguration, ImageIndex, ImageManifest};
use crate::MicrosandboxResult;
use super::ReferenceSelector;
#[async_trait]
pub trait OciRegistryPull {
async fn pull_image(
&self,
repository: &str,
selector: ReferenceSelector,
) -> MicrosandboxResult<()>;
async fn fetch_index(
&self,
repository: &str,
selector: ReferenceSelector,
) -> MicrosandboxResult<ImageIndex>;
async fn fetch_manifest(
&self,
repository: &str,
digest: &Digest,
) -> MicrosandboxResult<ImageManifest>;
async fn fetch_config(
&self,
repository: &str,
digest: &Digest,
) -> MicrosandboxResult<ImageConfiguration>;
async fn fetch_image_blob(
&self,
repository: &str,
digest: &Digest,
range: impl RangeBounds<u64> + Send,
) -> MicrosandboxResult<BoxStream<'static, MicrosandboxResult<Bytes>>>;
}