Skip to main content

SecretBackend

Trait SecretBackend 

Source
pub trait SecretBackend:
    Send
    + Sync
    + 'static {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn load_all<'life0, 'life1, 'async_trait>(
        &'life0 self,
        group_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyRecord>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn poll_new<'life0, 'life1, 'async_trait>(
        &'life0 self,
        group_id: &'life1 str,
        since_time: SystemTime,
        since_id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyRecord>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Read-side storage contract used by SecretSyncer.

Implement this trait (alongside SecretRotationBackend if the same backend serves both roles) to connect SecretSyncer to your storage layer. Built-in implementations are available behind feature flags: DieselPgSecretBackend (pg-diesel-async) and SqlxPgSecretBackend (pg-sqlx).

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type returned on backend failures.

Required Methods§

Source

fn load_all<'life0, 'life1, 'async_trait>( &'life0 self, group_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyRecord>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load all keys for group_id, ordered by activated_at ascending.

Called once at startup by SecretSyncer::initial_load.

Source

fn poll_new<'life0, 'life1, 'async_trait>( &'life0 self, group_id: &'life1 str, since_time: SystemTime, since_id: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<KeyRecord>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return keys inserted after (since_time, since_id), ordered by activated_at ascending.

The cursor is a (SystemTime, i64) pair — both components must be strictly greater than the cursor for a record to be returned, ensuring no record is delivered twice even when multiple records share the same activated_at.

Implementors§