pub trait PathInfoService: Send + Sync {
// Required methods
fn get<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<Option<PathInfo>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn put<'life0, 'async_trait>(
&'life0 self,
path_info: PathInfo,
) -> Pin<Box<dyn Future<Output = Result<PathInfo, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>;
// Provided methods
fn has<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn nar_calculation_service(&self) -> Option<Box<dyn NarCalculationService>> { ... }
}Expand description
The base trait all PathInfo services need to implement.
Required Methods§
Sourcefn get<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<Option<PathInfo>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<Option<PathInfo>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve a PathInfo by the output digest.
Sourcefn put<'life0, 'async_trait>(
&'life0 self,
path_info: PathInfo,
) -> Pin<Box<dyn Future<Output = Result<PathInfo, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
path_info: PathInfo,
) -> Pin<Box<dyn Future<Output = Result<PathInfo, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store a PathInfo.
Sourcefn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>
fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>
Iterate over all PathInfo objects in the store. Implementations can decide to disallow listing.
This returns a pinned, boxed stream. The pinning allows for it to be polled easily, and the box allows different underlying stream implementations to be returned since Rust doesn’t support this as a generic in traits yet. This is the same thing that async_trait generates, but for streams instead of futures.
Provided Methods§
Sourcefn has<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if a PathInfo exists. Has a naïve default impl, but store implementations may decide to implement their own.
Sourcefn nar_calculation_service(&self) -> Option<Box<dyn NarCalculationService>>
fn nar_calculation_service(&self) -> Option<Box<dyn NarCalculationService>>
Returns a (more) suitable NarCalculationService. This can be used to offload NAR calculation to the remote side.
Implementations on Foreign Types§
Source§impl<'a, T: 'a + PathInfoService + ?Sized> PathInfoService for &'a T
impl<'a, T: 'a + PathInfoService + ?Sized> PathInfoService for &'a T
fn get<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<Option<PathInfo>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
path_info: PathInfo,
) -> Pin<Box<dyn Future<Output = Result<PathInfo, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>
fn nar_calculation_service(&self) -> Option<Box<dyn NarCalculationService>>
Source§impl<'a, T: 'a + PathInfoService + ?Sized> PathInfoService for &'a mut T
impl<'a, T: 'a + PathInfoService + ?Sized> PathInfoService for &'a mut T
fn get<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<Option<PathInfo>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
path_info: PathInfo,
) -> Pin<Box<dyn Future<Output = Result<PathInfo, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>
fn nar_calculation_service(&self) -> Option<Box<dyn NarCalculationService>>
Source§impl<T: PathInfoService + ?Sized> PathInfoService for Box<T>
impl<T: PathInfoService + ?Sized> PathInfoService for Box<T>
fn get<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<Option<PathInfo>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
path_info: PathInfo,
) -> Pin<Box<dyn Future<Output = Result<PathInfo, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>
fn nar_calculation_service(&self) -> Option<Box<dyn NarCalculationService>>
Source§impl<T: PathInfoService + ?Sized> PathInfoService for Arc<T>
impl<T: PathInfoService + ?Sized> PathInfoService for Arc<T>
fn get<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<Option<PathInfo>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has<'life0, 'async_trait>(
&'life0 self,
digest: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
path_info: PathInfo,
) -> Pin<Box<dyn Future<Output = Result<PathInfo, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>
fn nar_calculation_service(&self) -> Option<Box<dyn NarCalculationService>>
Implementors§
impl PathInfoService for BigtablePathInfoService
Available on crate feature
cloud only.