Skip to main content

PathInfoService

Trait PathInfoService 

Source
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<Arc<dyn NarCalculationService>> { ... }
}
Expand description

The base trait all PathInfo services need to implement.

Required Methods§

Source

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.

Source

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.

Source

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.

Even though this function is not async, underlying implementations are assumed to be nonblocking on IO, so they MUST use spawn_blocking when doing IO. Implementations can assume to be invoked in the context of a tokio runtime.

Provided Methods§

Source

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.

Source

fn nar_calculation_service(&self) -> Option<Arc<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
where &'a T: Send + Sync,

Source§

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,

Source§

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,

Source§

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,

Source§

fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>

Source§

fn nar_calculation_service(&self) -> Option<Arc<dyn NarCalculationService>>

Source§

impl<'a, T: 'a + PathInfoService + ?Sized> PathInfoService for &'a mut T
where &'a mut T: Send + Sync,

Source§

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,

Source§

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,

Source§

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,

Source§

fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>

Source§

fn nar_calculation_service(&self) -> Option<Arc<dyn NarCalculationService>>

Source§

impl<T: PathInfoService + ?Sized> PathInfoService for Box<T>
where Box<T>: Send + Sync,

Source§

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,

Source§

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,

Source§

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,

Source§

fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>

Source§

fn nar_calculation_service(&self) -> Option<Arc<dyn NarCalculationService>>

Source§

impl<T: PathInfoService + ?Sized> PathInfoService for Arc<T>
where Arc<T>: Send + Sync,

Source§

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,

Source§

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,

Source§

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,

Source§

fn list(&self) -> BoxStream<'static, Result<PathInfo, Error>>

Source§

fn nar_calculation_service(&self) -> Option<Arc<dyn NarCalculationService>>

Implementors§

Source§

impl PathInfoService for BigtablePathInfoService

Available on crate feature cloud only.
Source§

impl PathInfoService for LruPathInfoService

Source§

impl PathInfoService for MockPathInfoService

The base trait all PathInfo services need to implement.

Source§

impl PathInfoService for RedbPathInfoService

Source§

impl<BS, DS> PathInfoService for NixHTTPPathInfoService<BS, DS>
where BS: BlobService + Send + Sync + Clone + 'static, DS: DirectoryService + Send + Sync + Clone + 'static,

Source§

impl<PS1, PS2> PathInfoService for Cache<PS1, PS2>

Source§

impl<T> PathInfoService for GRPCPathInfoService<T>
where T: GrpcService<Body> + Send + Sync + Clone + 'static, T::ResponseBody: Body<Data = Bytes> + Send + 'static, <T::ResponseBody as Body>::Error: Into<StdError> + Send, T::Future: Send,

Source§

impl<T, S> PathInfoService for SigningPathInfoService<T, S>