Skip to main content

NamespaceProvider

Trait NamespaceProvider 

Source
pub trait NamespaceProvider: Send + Sync {
    // Required methods
    fn create_namespaces(
        &self,
        request: &NamespaceRequest,
    ) -> Result<NamespaceResponse, NamespaceError>;
    fn release_namespaces(
        &self,
        allocation_id: &str,
    ) -> Result<(), NamespaceError>;
}
Expand description

Trait for the namespace handoff provider (pact-agent implements).

Creates Linux namespaces for allocations and makes their FDs available for passing to lattice via the unix socket.

Required Methods§

Source

fn create_namespaces( &self, request: &NamespaceRequest, ) -> Result<NamespaceResponse, NamespaceError>

Create namespaces for an allocation.

Returns metadata about the created namespaces. The actual FDs are made available for the handoff socket to send via SCM_RIGHTS.

§Errors

Returns NamespaceError::CreationFailed if unshare(2) or namespace setup fails.

Source

fn release_namespaces(&self, allocation_id: &str) -> Result<(), NamespaceError>

Release namespaces for a completed allocation.

Cleans up namespace FDs and any associated resources (bind-mounts).

Implementors§