Skip to main content

StorageProxyBackend

Trait StorageProxyBackend 

Source
pub trait StorageProxyBackend<Cx = ()>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn authorize<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        req: &'life1 ProxyReq,
        cx: &'life2 Cx,
    ) -> Pin<Box<dyn Future<Output = ProxyResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn open<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        req: &'life1 ProxyReq,
        cx: &'life2 Cx,
    ) -> Pin<Box<dyn Future<Output = ProxyResult<Arc<DynObjectStore>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn capabilities(&self) -> ProxyCapabilities { ... }
}
Available on crate feature server only.
Expand description

The backend port: authorize a request and open a verb-scoped, prefixed store.

Cx is the host’s per-request context (mangrove uses its RequestContext; the in-memory testing backend uses ()). authorize runs first and MUST enforce both the caller’s permission for the verb and the confused-deputy path-scope guard; open then returns a store prefixed at the securable root, so a ProxyReq::key addresses relative to it and cannot escape.

Required Methods§

Source

fn authorize<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, req: &'life1 ProxyReq, cx: &'life2 Cx, ) -> Pin<Box<dyn Future<Output = ProxyResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Authorize + scope-check the request. Runs before open.

Must reject a caller lacking the verb’s access level (ProxyError::PermissionDenied / Unauthenticated) and any key that escapes the securable’s authorized root (ProxyError::OutOfScope).

Source

fn open<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, req: &'life1 ProxyReq, cx: &'life2 Cx, ) -> Pin<Box<dyn Future<Output = ProxyResult<Arc<DynObjectStore>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Open a store scoped to req.securable at the access level implied by the verb (Get/Head → read, Put → read-write). The returned store is prefixed at the securable root, so req.key addresses relative to it.

open performs no authorization — that already happened in authorize.

Provided Methods§

Source

fn capabilities(&self) -> ProxyCapabilities

The proxy capabilities this backend advertises.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<Cx: ForwardedUser + Send + Sync + 'static> StorageProxyBackend<Cx> for UnityFactoryProxyBackend

Available on crate feature client-arm only.
Source§

impl<Cx: Send + Sync + 'static> StorageProxyBackend<Cx> for InMemoryStorageProxyBackend

Available on crate feature testing only.