pub trait LambdaBackend:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &str;
fn launch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
func: &'life1 LambdaFunction,
code_zip: Option<&'life2 [u8]>,
layers: &'life3 [Vec<u8>],
deploy_id: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<WarmInstance, RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn terminate<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 BackendHandle,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn reap_stale<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn prepull_image<'life0, 'life1, 'async_trait>(
&'life0 self,
_image: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Short identifier surfaced via logs and introspection (e.g.
"docker", "podman", "kubernetes").
Sourcefn launch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
func: &'life1 LambdaFunction,
code_zip: Option<&'life2 [u8]>,
layers: &'life3 [Vec<u8>],
deploy_id: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<WarmInstance, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn launch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
func: &'life1 LambdaFunction,
code_zip: Option<&'life2 [u8]>,
layers: &'life3 [Vec<u8>],
deploy_id: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<WarmInstance, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Launch a fresh runtime instance for func using the supplied
code (for zip-package functions) or func.image_uri (for image
package functions). layers are the attached layer ZIPs in
attach order. deploy_id is the facade-computed fingerprint
used to label resources so reaper logic can correlate.
Sourcefn terminate<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 BackendHandle,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn terminate<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 BackendHandle,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Tear down one instance. Must be idempotent — the facade may call this against an already-gone instance during cleanup races.
Provided Methods§
Sourcefn reap_stale<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reap_stale<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sweep instances that belong to a previous fakecloud process so their function names don’t leak across restarts. Default no-op; backends with out-of-process state should override.
Sourcefn prepull_image<'life0, 'life1, 'async_trait>(
&'life0 self,
_image: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn prepull_image<'life0, 'life1, 'async_trait>(
&'life0 self,
_image: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Optional hook: pre-warm the runtime image so the first launch()
for a function doesn’t pay the cold-pull cost. Called in the
background after CreateFunction persists; backends that don’t
benefit from pre-pulling (e.g. Kubernetes, which pulls images on
the scheduling node anyway) leave this as a no-op.
image is the registry URI fetched from runtime_to_image for
Zip-package functions, or the user-supplied ImageUri (already
translated to the local registry if applicable) for Image-package
functions.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".