pub struct ContainerRuntime { /* private fields */ }Expand description
Docker/Podman-based Lambda execution engine.
Implementations§
Source§impl ContainerRuntime
impl ContainerRuntime
Sourcepub fn new(server_port: u16) -> Option<Self>
pub fn new(server_port: u16) -> Option<Self>
Auto-detect Docker or Podman. Returns None if neither is available.
Override with FAKECLOUD_CONTAINER_CLI env var.
server_port is the port the main fakecloud server bound to; used
to resolve PackageType=Image ECR URIs against fakecloud ECR.
pub fn cli_name(&self) -> &str
Sourcepub async fn invoke(
&self,
func: &LambdaFunction,
payload: &[u8],
layers: &[Vec<u8>],
) -> Result<Vec<u8>, RuntimeError>
pub async fn invoke( &self, func: &LambdaFunction, payload: &[u8], layers: &[Vec<u8>], ) -> Result<Vec<u8>, RuntimeError>
Invoke a Lambda function, starting a container if needed. Layer
ZIPs are extracted into /opt of the runtime sandbox; AWS base
images already include /opt/python, /opt/nodejs/node_modules,
/opt/lib, and /opt/bin on the right import paths.
Sourcepub async fn stop_container(&self, function_name: &str)
pub async fn stop_container(&self, function_name: &str)
Stop and remove a container for a specific function.
Sourcepub async fn stop_all(&self)
pub async fn stop_all(&self)
Stop and remove all containers (used on server shutdown or reset).
Sourcepub fn list_warm_containers(
&self,
lambda_state: &SharedLambdaState,
) -> Vec<Value>
pub fn list_warm_containers( &self, lambda_state: &SharedLambdaState, ) -> Vec<Value>
List all warm containers and their metadata for introspection.
Sourcepub async fn evict_container(&self, function_name: &str) -> bool
pub async fn evict_container(&self, function_name: &str) -> bool
Evict (stop and remove) the warm container for a specific function. Returns true if a container was found and evicted.
Sourcepub async fn run_cleanup_loop(self: Arc<Self>, ttl: Duration)
pub async fn run_cleanup_loop(self: Arc<Self>, ttl: Duration)
Background loop that stops containers idle longer than ttl.