Skip to main content

BindingsProviderApi

Trait BindingsProviderApi 

Source
pub trait BindingsProviderApi:
    Send
    + Sync
    + Debug {
    // Required methods
    fn load_storage<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Storage>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_build<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Build>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_artifact_registry<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ArtifactRegistry>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_vault<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Vault>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_kv<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Kv>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_postgres<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Postgres>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_queue<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Queue>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_worker<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Worker>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_container<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Container>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_service_account<'life0, 'life1, 'async_trait>(
        &'life0 self,
        binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ServiceAccount>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn resolve_runtime_only_binding_env<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _binding_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<HashMap<String, String>>, AlienError<ErrorData>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
}
Expand description

A provider must implement methods to load the various types of bindings based on environment variables or other configuration sources.

Required Methods§

Source

fn load_storage<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Storage>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds a Storage implementation.

Source

fn load_build<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Build>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds a Build implementation.

Source

fn load_artifact_registry<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ArtifactRegistry>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds an ArtifactRegistry implementation.

Source

fn load_vault<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Vault>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds a Vault implementation.

Source

fn load_kv<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Kv>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds a KV implementation.

Source

fn load_postgres<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Postgres>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds a Postgres implementation.

Only the local (developer) backend is supported here. Cloud backends (Aurora, CloudSQL, Azure Flexible Server) are resolved by the TypeScript SDK only; a Rust worker that requests one gets a runtime error from the local resolver, with no compile-time gate.

Source

fn load_queue<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Queue>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds a Queue implementation.

Source

fn load_worker<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Worker>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds a Worker implementation.

Source

fn load_container<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Container>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds a Container implementation.

Source

fn load_service_account<'life0, 'life1, 'async_trait>( &'life0 self, binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ServiceAccount>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Given a binding identifier, builds a ServiceAccount implementation.

Provided Methods§

Source

fn resolve_runtime_only_binding_env<'life0, 'life1, 'async_trait>( &'life0 self, _binding_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<HashMap<String, String>>, AlienError<ErrorData>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Runtime-only binding env vars (a local Postgres connection with its password) for the given resource — re-resolved on every (re)start so the secret reaches the worker process but is never written to persisted worker metadata. Default None: cloud providers carry a secret locator (not a password) and use the normal persisted path.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§