pub struct InMemoryProvider { /* private fields */ }Expand description
Thread-safe in-memory resource provider supporting both single and multi-tenant operations.
This provider organizes data as: tenant_id -> resource_type -> resource_id -> resource For single-tenant operations, it uses “default” as the tenant_id.
Implementations§
Source§impl InMemoryProvider
impl InMemoryProvider
Sourcepub async fn get_stats(&self) -> InMemoryStats
pub async fn get_stats(&self) -> InMemoryStats
Get statistics about stored data.
Source§impl InMemoryProvider
impl InMemoryProvider
pub async fn conditional_update( &self, resource_type: &str, id: &str, data: Value, expected_version: &ScimVersion, context: &RequestContext, ) -> Result<ConditionalResult<VersionedResource>, InMemoryError>
pub async fn conditional_delete( &self, resource_type: &str, id: &str, expected_version: &ScimVersion, context: &RequestContext, ) -> Result<ConditionalResult<()>, InMemoryError>
pub async fn conditional_patch_resource( &self, resource_type: &str, id: &str, patch_request: &Value, expected_version: &ScimVersion, context: &RequestContext, ) -> Result<ConditionalResult<VersionedResource>, InMemoryError>
pub async fn get_versioned_resource( &self, resource_type: &str, id: &str, context: &RequestContext, ) -> Result<Option<VersionedResource>, InMemoryError>
pub async fn create_versioned_resource( &self, resource_type: &str, data: Value, context: &RequestContext, ) -> Result<VersionedResource, InMemoryError>
Trait Implementations§
Source§impl Clone for InMemoryProvider
impl Clone for InMemoryProvider
Source§fn clone(&self) -> InMemoryProvider
fn clone(&self) -> InMemoryProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemoryProvider
impl Debug for InMemoryProvider
Source§impl Default for InMemoryProvider
impl Default for InMemoryProvider
Source§impl ResourceProvider for InMemoryProvider
impl ResourceProvider for InMemoryProvider
Source§fn apply_patch_operation(
&self,
resource_data: &mut Value,
operation: &Value,
) -> Result<(), Self::Error>
fn apply_patch_operation( &self, resource_data: &mut Value, operation: &Value, ) -> Result<(), Self::Error>
Override the default patch operation implementation
type Error = InMemoryError
Source§async fn create_resource(
&self,
resource_type: &str,
data: Value,
context: &RequestContext,
) -> Result<Resource, Self::Error>
async fn create_resource( &self, resource_type: &str, data: Value, context: &RequestContext, ) -> Result<Resource, Self::Error>
Create a resource for the tenant specified in the request context. Read more
Source§async fn get_resource(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> Result<Option<Resource>, Self::Error>
async fn get_resource( &self, resource_type: &str, id: &str, context: &RequestContext, ) -> Result<Option<Resource>, Self::Error>
Get a resource by ID from the tenant specified in the request context. Read more
Source§async fn update_resource(
&self,
resource_type: &str,
id: &str,
data: Value,
context: &RequestContext,
) -> Result<Resource, Self::Error>
async fn update_resource( &self, resource_type: &str, id: &str, data: Value, context: &RequestContext, ) -> Result<Resource, Self::Error>
Update a resource in the tenant specified in the request context. Read more
Source§async fn delete_resource(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> Result<(), Self::Error>
async fn delete_resource( &self, resource_type: &str, id: &str, context: &RequestContext, ) -> Result<(), Self::Error>
Delete a resource from the tenant specified in the request context. Read more
Source§async fn list_resources(
&self,
resource_type: &str,
query: Option<&ListQuery>,
context: &RequestContext,
) -> Result<Vec<Resource>, Self::Error>
async fn list_resources( &self, resource_type: &str, query: Option<&ListQuery>, context: &RequestContext, ) -> Result<Vec<Resource>, Self::Error>
List resources from the tenant specified in the request context. Read more
Source§async fn find_resource_by_attribute(
&self,
resource_type: &str,
attribute: &str,
value: &Value,
context: &RequestContext,
) -> Result<Option<Resource>, Self::Error>
async fn find_resource_by_attribute( &self, resource_type: &str, attribute: &str, value: &Value, context: &RequestContext, ) -> Result<Option<Resource>, Self::Error>
Find a resource by attribute value within the tenant specified in the request context. Read more
Source§async fn resource_exists(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> Result<bool, Self::Error>
async fn resource_exists( &self, resource_type: &str, id: &str, context: &RequestContext, ) -> Result<bool, Self::Error>
Check if a resource exists within the tenant specified in the request context. Read more
Source§async fn patch_resource(
&self,
resource_type: &str,
id: &str,
patch_request: &Value,
context: &RequestContext,
) -> Result<Resource, Self::Error>
async fn patch_resource( &self, resource_type: &str, id: &str, patch_request: &Value, context: &RequestContext, ) -> Result<Resource, Self::Error>
Apply PATCH operations to a resource within the tenant specified in the request context. Read more
Source§fn conditional_update(
&self,
resource_type: &str,
id: &str,
data: Value,
expected_version: &ScimVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
fn conditional_update(
&self,
resource_type: &str,
id: &str,
data: Value,
expected_version: &ScimVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
Conditionally update a resource if the version matches. Read more
Source§fn conditional_delete(
&self,
resource_type: &str,
id: &str,
expected_version: &ScimVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<()>, Self::Error>> + Sendwhere
Self: Sync,
fn conditional_delete(
&self,
resource_type: &str,
id: &str,
expected_version: &ScimVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<()>, Self::Error>> + Sendwhere
Self: Sync,
Conditionally delete a resource if the version matches. Read more
Source§fn get_versioned_resource(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> impl Future<Output = Result<Option<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
fn get_versioned_resource(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> impl Future<Output = Result<Option<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
Get a resource with its version information. Read more
Auto Trait Implementations§
impl Freeze for InMemoryProvider
impl !RefUnwindSafe for InMemoryProvider
impl Send for InMemoryProvider
impl Sync for InMemoryProvider
impl Unpin for InMemoryProvider
impl !UnwindSafe for InMemoryProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ResourceProviderExt for Twhere
T: ResourceProvider,
impl<T> ResourceProviderExt for Twhere
T: ResourceProvider,
Source§fn create_single_tenant(
&self,
resource_type: &str,
data: Value,
request_id: Option<String>,
) -> impl Future<Output = Result<Resource, Self::Error>> + Sendwhere
Self: Sync,
fn create_single_tenant(
&self,
resource_type: &str,
data: Value,
request_id: Option<String>,
) -> impl Future<Output = Result<Resource, Self::Error>> + Sendwhere
Self: Sync,
Convenience method for single-tenant resource creation. Read more
Source§fn create_multi_tenant(
&self,
tenant_id: &str,
resource_type: &str,
data: Value,
request_id: Option<String>,
) -> impl Future<Output = Result<Resource, Self::Error>> + Sendwhere
Self: Sync,
fn create_multi_tenant(
&self,
tenant_id: &str,
resource_type: &str,
data: Value,
request_id: Option<String>,
) -> impl Future<Output = Result<Resource, Self::Error>> + Sendwhere
Self: Sync,
Convenience method for multi-tenant resource creation. Read more
Source§impl<T> TenantValidator for T
impl<T> TenantValidator for T
Source§fn validate_tenant_context(
&self,
expected_tenant_id: &str,
context: &RequestContext,
) -> Result<(), String>
fn validate_tenant_context( &self, expected_tenant_id: &str, context: &RequestContext, ) -> Result<(), String>
Validate that the context has the expected tenant.
Source§fn validate_single_tenant_context(
&self,
context: &RequestContext,
) -> Result<(), String>
fn validate_single_tenant_context( &self, context: &RequestContext, ) -> Result<(), String>
Validate that the context is for single-tenant operation.
Source§fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>
fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>
Extract tenant context or return error for multi-tenant operations.
Source§impl<P> ToSingleTenant<P> for Pwhere
P: ResourceProvider,
impl<P> ToSingleTenant<P> for Pwhere
P: ResourceProvider,
Source§fn to_single_tenant(self) -> TenantValidatingProvider<P>
fn to_single_tenant(self) -> TenantValidatingProvider<P>
Convert to a provider that validates single-tenant contexts.