Skip to main content

PolicySource

Trait PolicySource 

Source
pub trait PolicySource:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn snapshot<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Db, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn changed<'life0, 'async_trait>(
        &'life0 self,
        basis_t: u64,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Supplies snapshots of the authorization database.

Required Methods§

Source

fn name(&self) -> &str

Name of the authz database, for errors and audit lines.

Source

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

The current snapshot.

§Errors

Returns SourceError when the database is missing or unreadable; the authorizer fails closed on it.

Provided Methods§

Source

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

Resolves when the source may have advanced past basis_t.

The default polls. Sources with a change signal (a transactor’s basis watch, a peer’s tx-report broadcast) override this so a policy change propagates immediately instead of within one poll interval.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§