Trait IndexProvider

Source
pub trait IndexProvider: Sync {
    type Config;

    // Required methods
    fn healthcheck<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_sparse_entry<'life0, 'life1, 'async_trait>(
        &'life0 self,
        crate_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = IndexResult<Vec<CrateVersion>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn confirm_existence<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        crate_name: &'life1 str,
        version: &'life2 Version,
    ) -> Pin<Box<dyn Future<Output = IndexResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn yank_crate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        crate_name: &'life1 str,
        version: &'life2 Version,
    ) -> Pin<Box<dyn Future<Output = IndexResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn unyank_crate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        crate_name: &'life1 str,
        version: &'life2 Version,
    ) -> Pin<Box<dyn Future<Output = IndexResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn search<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_string: &'life1 str,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = IndexResult<SearchResults>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn publish<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        version: &'life1 Publish,
        checksum: &'life2 str,
        end_step: Pin<&'life3 mut (dyn Future<Output = IndexResult<()>> + Send)>,
    ) -> Pin<Box<dyn Future<Output = IndexResult<CompletedPublication>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pagination: &'life1 ListQuery,
    ) -> Pin<Box<dyn Future<Output = IndexResult<ListAll>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Available on crate feature index only.
Expand description

A client for talking with a backing index database or storage medium.

Operations performed via this client MUST be atomic. In the event of a conflict, IndexError::Conflict should be returned by an operation.

§Note

The index client does NOT authenticate user actions. User actions should be authenticated before an operation is performed.

Required Associated Types§

Required Methods§

Source

fn healthcheck<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_sparse_entry<'life0, 'life1, 'async_trait>( &'life0 self, crate_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = IndexResult<Vec<CrateVersion>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the sparse index entry for a crate.

If successful, a CrateVersion api object will be returned.

If the crate could not be found in the index, None will be returned.

If an error occurs while trying to generate the sparse entry, IndexError::ServiceError will be returned.

Source

fn confirm_existence<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, crate_name: &'life1 str, version: &'life2 Version, ) -> Pin<Box<dyn Future<Output = IndexResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Confirm that a particular crate and version pair exists, and return its yank status

Source

fn yank_crate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, crate_name: &'life1 str, version: &'life2 Version, ) -> Pin<Box<dyn Future<Output = IndexResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Yank a crate version.

Source

fn unyank_crate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, crate_name: &'life1 str, version: &'life2 Version, ) -> Pin<Box<dyn Future<Output = IndexResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Unyank a crate version

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, query_string: &'life1 str, limit: usize, ) -> Pin<Box<dyn Future<Output = IndexResult<SearchResults>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Search the index for crates satisfying a query string, returning up to limit results.

The syntax and semantics of the search are up to the implementation to define.

Source

fn publish<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, version: &'life1 Publish, checksum: &'life2 str, end_step: Pin<&'life3 mut (dyn Future<Output = IndexResult<()>> + Send)>, ) -> Pin<Box<dyn Future<Output = IndexResult<CompletedPublication>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Publish a crate version.

end_step is a future to run after the crate has been submitted to the index, but before any transactional commits have occurred. If it fails, the operation MUST be rolled back.

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, pagination: &'life1 ListQuery, ) -> Pin<Box<dyn Future<Output = IndexResult<ListAll>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List crates in the index, optionally specifying pagination.

If no pagination is provided, all crates should be returned.

Implementors§