Trait tvix_store::pathinfoservice::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 method
    fn nar_calculation_service(&self) -> Option<Box<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 message 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 message. Implementations MUST call validate and reject invalid messages.

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.

Provided Methods§

Implementors§