Skip to main content

Source

Trait Source 

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

    // Provided method
    fn refresh<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 SourceCtx,
        current: &'life2 Overlay,
    ) -> Pin<Box<dyn Future<Output = Result<Overlay, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Something outside the store an instance takes variables, endpoints and credentials from, as an overlay on its environment (a Neon branch, say: its Postgres URL, its object-storage endpoint and vended keys, its function URLs). An instance binds the sources it takes; they apply in that order, above the store’s vars and below the instance’s own overrides.

Required Methods§

Source

fn name(&self) -> &str

The name instances refer to it by.

Source

fn overlay<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 SourceCtx, ) -> Pin<Box<dyn Future<Output = Result<Overlay, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The overlay for the instance ctx describes.

Provided Methods§

Source

fn refresh<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 SourceCtx, current: &'life2 Overlay, ) -> Pin<Box<dyn Future<Output = Result<Overlay, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

A fresh overlay once current has expired. The default asks again.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Source for NeonBranchSource

Available on crate feature neon only.
Source§

impl Source for UserVars