#[cfg(feature = "oci-live")]
mod live;
#[cfg(feature = "oci-live")]
pub use live::OciRegistry;
#[cfg(not(feature = "oci-live"))]
use crate::image_ref::ImageRef;
#[cfg(not(feature = "oci-live"))]
use crate::registry::{LayerSet, Registry, RegistryError};
#[cfg(not(feature = "oci-live"))]
use async_trait::async_trait;
#[cfg(not(feature = "oci-live"))]
use pf_core::cas::BlobStore;
#[cfg(not(feature = "oci-live"))]
use pf_core::manifest::Manifest;
#[cfg(not(feature = "oci-live"))]
#[derive(Debug, Default)]
pub struct OciRegistry {
_auth: std::collections::BTreeMap<String, String>,
}
#[cfg(not(feature = "oci-live"))]
impl OciRegistry {
pub fn new(auth: std::collections::BTreeMap<String, String>) -> Self {
Self { _auth: auth }
}
}
#[cfg(not(feature = "oci-live"))]
fn err() -> RegistryError {
RegistryError::UnsupportedScheme(
"oci:// — pf-registry built without `oci-live`. Rebuild with \
`--features oci-live` (default since v1.0.2) to enable OCI."
.into(),
)
}
#[cfg(not(feature = "oci-live"))]
#[async_trait]
impl Registry for OciRegistry {
async fn push(
&self,
_: &ImageRef,
_: &Manifest,
_: &dyn BlobStore,
) -> Result<(), RegistryError> {
Err(err())
}
async fn pull(&self, _: &ImageRef) -> Result<LayerSet, RegistryError> {
Err(err())
}
async fn exists(&self, _: &ImageRef) -> Result<bool, RegistryError> {
Err(err())
}
}