Skip to main content

xbp_oci/
traits.rs

1use async_trait::async_trait;
2
3use crate::error::Result;
4use crate::r#ref::OciRef;
5
6/// Resolve digests and existence without coupling callers to a registry SDK.
7#[async_trait]
8pub trait OciResolver: Send + Sync {
9    async fn resolve_digest(&self, image: &OciRef) -> Result<String>;
10    async fn exists(&self, image: &OciRef) -> Result<bool>;
11    async fn list_tags(&self, image: &OciRef, limit: Option<usize>) -> Result<Vec<String>>;
12}
13
14/// Promote/copy by digest (no rebuild).
15#[async_trait]
16pub trait OciPromoter: Send + Sync {
17    async fn promote(&self, source: &OciRef, target: &OciRef, force: bool) -> Result<()>;
18}