Skip to main content

FunctionStore

Trait FunctionStore 

Source
pub trait FunctionStore: Send + Sync {
    // Required methods
    fn store_function<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        runtime: RuntimeType,
        bytecode: Bytes,
    ) -> Pin<Box<dyn Future<Output = Result<FunctionRecord>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_function<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<FunctionRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_functions<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<FunctionRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_function<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for function deployment stores.

Implementors persist and retrieve versioned function bytecode.

The #[async_trait] attribute generates a dyn-compatible vtable so that Box<dyn FunctionStore> / Arc<dyn FunctionStore> work for dynamic dispatch.

Required Methods§

Source

fn store_function<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, runtime: RuntimeType, bytecode: Bytes, ) -> Pin<Box<dyn Future<Output = Result<FunctionRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Store a new version of a function, bumping its version number.

If a function with name already exists, a new version is created and previous versions are marked inactive.

§Errors

Returns Err if the write fails.

Source

fn get_function<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<FunctionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve the latest active version of a function by name.

Returns Ok(None) if no active function with that name exists.

§Errors

Returns Err if the read fails.

Source

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

List all active function records.

§Errors

Returns Err if the read fails.

Source

fn delete_function<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete (deactivate) all versions of a function by name.

Returns true if at least one active record was found and deactivated, false if no active function with that name existed.

§Errors

Returns Err if the write fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§