Skip to main content

LicenceClient

Trait LicenceClient 

Source
pub trait LicenceClient:
    Send
    + Sync
    + 'static {
    // Required methods
    fn checkout<'life0, 'life1, 'async_trait>(
        &'life0 self,
        req: &'life1 CheckoutWire,
    ) -> Pin<Box<dyn Future<Output = Result<SignedGrant, LicenceClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn artifact<'life0, 'life1, 'async_trait>(
        &'life0 self,
        blake3_hex: &'life1 str,
        max_len: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, LicenceClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn grants_since<'life0, 'async_trait>(
        &'life0 self,
        since: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SignedGrant>, LicenceClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn renew<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<GrantsPage, LicenceClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn grants_page<'life0, 'async_trait>(
        &'life0 self,
        since: u64,
    ) -> Pin<Box<dyn Future<Output = Result<GrantsPage, LicenceClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn release<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _cog_id: &'life1 str,
        _version: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<GrantsPage, LicenceClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

What the checkout relay needs from weft-licence.

Required Methods§

Source

fn checkout<'life0, 'life1, 'async_trait>( &'life0 self, req: &'life1 CheckoutWire, ) -> Pin<Box<dyn Future<Output = Result<SignedGrant, LicenceClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

POST /licence/v1/checkout: the signed grant, with seq persisted by the Seed before release.

Source

fn artifact<'life0, 'life1, 'async_trait>( &'life0 self, blake3_hex: &'life1 str, max_len: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, LicenceClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

GET /licence/v1/artifact/<blake3>: the cached binary. At most max_len bytes are accepted.

Source

fn grants_since<'life0, 'async_trait>( &'life0 self, since: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<SignedGrant>, LicenceClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GET /licence/v1/grants?since=<seq>: renewal batch.

Provided Methods§

Source

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

POST /licence/v1/renew: a new grant (or a withdrawal) for every active checkout, at most one batch. next is the Seed’s issue counter after the renewal (the bound for the catch-up cursor).

Source

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

Self::grants_since with the paging cursor.

Source

fn release<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _cog_id: &'life1 str, _version: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<GrantsPage, LicenceClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

POST /licence/v1/renew with {"release": [{cog_id, version}]}: the Seed withdraws that checkout (a renewal whose expires_at <= issued_at) and, as for any renewal, renews every other active one.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§