#[non_exhaustive]pub struct TenantStorage { /* private fields */ }Expand description
Storage facade permanently bound to one authenticated tenant context.
Object keys are placed below tenants/<tenant_id>/; callers cannot escape
that prefix through absolute paths, parent components, or backslashes. The
tenant identifier itself must be exactly one normal path segment: object
operations fail with StorageError::PathTraversal when it is empty,
contains / or \, or consists only of dots. The wrapper provides
namespace isolation, while membership authorization and backend bucket
policy remain application and deployment responsibilities.
Implementations§
Source§impl TenantStorage
impl TenantStorage
Sourcepub fn from_context(storage: Storage, context: &TenantContext) -> Self
pub fn from_context(storage: Storage, context: &TenantContext) -> Self
Binds a storage engine to a tenant already validated by authentication.
Sourcepub fn tenant_id(&self) -> &str
pub fn tenant_id(&self) -> &str
Returns the authenticated tenant identifier bound to this instance.
Sourcepub fn object_key(&self, relative_path: &str) -> Result<String, StorageError>
pub fn object_key(&self, relative_path: &str) -> Result<String, StorageError>
Returns the backend object key confined below the tenant namespace.
Sourcepub async fn put(
&self,
relative_path: &str,
bytes: &[u8],
) -> Result<(), StorageError>
pub async fn put( &self, relative_path: &str, bytes: &[u8], ) -> Result<(), StorageError>
Stores bytes below this instance’s immutable tenant prefix.