pub struct SqliteStorage { /* private fields */ }
Expand description
SQLite-based storage provider for SCIM resources.
Provides persistent storage with the same interface as InMemoryStorage. Uses a simple key-value table structure for efficient storage and retrieval.
Implementations§
Source§impl SqliteStorage
impl SqliteStorage
Sourcepub async fn new() -> Result<Self, StorageError>
pub async fn new() -> Result<Self, StorageError>
Create a new SQLite storage instance with the default database file path.
Creates or opens the database at scim_data/scim_server.db
. The database file
will be created if it doesn’t exist, along with the scim_data
directory.
§Returns
A new SqliteStorage instance with initialized database schema.
Sourcepub async fn new_with_path(database_path: &str) -> Result<Self, StorageError>
pub async fn new_with_path(database_path: &str) -> Result<Self, StorageError>
Create a new SQLite storage instance with a custom database file path.
§Arguments
database_path
- Path to the SQLite database file
§Returns
A new SqliteStorage instance with initialized database schema.
§Behavior
- Creates the database file if it doesn’t exist
- Creates parent directories if they don’t exist
- Opens existing database for read-write access
Sourcepub async fn new_in_memory() -> Result<Self, StorageError>
pub async fn new_in_memory() -> Result<Self, StorageError>
Create a new in-memory SQLite storage instance for testing.
§Returns
A new SqliteStorage instance with initialized database schema.
Trait Implementations§
Source§impl StorageProvider for SqliteStorage
impl StorageProvider for SqliteStorage
Source§type Error = StorageError
type Error = StorageError
The error type returned by storage operations.
Source§async fn put(&self, key: StorageKey, data: Value) -> Result<Value, Self::Error>
async fn put(&self, key: StorageKey, data: Value) -> Result<Value, Self::Error>
Store data at the specified key and return the stored data. Read more
Source§async fn get(&self, key: StorageKey) -> Result<Option<Value>, Self::Error>
async fn get(&self, key: StorageKey) -> Result<Option<Value>, Self::Error>
Retrieve data by key. Read more
Source§async fn delete(&self, key: StorageKey) -> Result<bool, Self::Error>
async fn delete(&self, key: StorageKey) -> Result<bool, Self::Error>
Delete data by key. Read more
Source§async fn list(
&self,
prefix: StoragePrefix,
offset: usize,
limit: usize,
) -> Result<Vec<(StorageKey, Value)>, Self::Error>
async fn list( &self, prefix: StoragePrefix, offset: usize, limit: usize, ) -> Result<Vec<(StorageKey, Value)>, Self::Error>
List resources matching a prefix with pagination. Read more
Source§async fn find_by_attribute(
&self,
prefix: StoragePrefix,
attribute: &str,
value: &str,
) -> Result<Vec<(StorageKey, Value)>, Self::Error>
async fn find_by_attribute( &self, prefix: StoragePrefix, attribute: &str, value: &str, ) -> Result<Vec<(StorageKey, Value)>, Self::Error>
Find resources by a specific attribute value. Read more
Source§async fn exists(&self, key: StorageKey) -> Result<bool, Self::Error>
async fn exists(&self, key: StorageKey) -> Result<bool, Self::Error>
Check if a resource exists. Read more
Source§async fn count(&self, prefix: StoragePrefix) -> Result<usize, Self::Error>
async fn count(&self, prefix: StoragePrefix) -> Result<usize, Self::Error>
Count the total number of resources matching a prefix. Read more
Source§async fn list_tenants(&self) -> Result<Vec<String>, Self::Error>
async fn list_tenants(&self) -> Result<Vec<String>, Self::Error>
List all tenant IDs that currently have data in storage. Read more
Source§async fn list_resource_types(
&self,
tenant_id: &str,
) -> Result<Vec<String>, Self::Error>
async fn list_resource_types( &self, tenant_id: &str, ) -> Result<Vec<String>, Self::Error>
List all resource types for a specific tenant. Read more
Auto Trait Implementations§
impl Freeze for SqliteStorage
impl !RefUnwindSafe for SqliteStorage
impl Send for SqliteStorage
impl Sync for SqliteStorage
impl Unpin for SqliteStorage
impl !UnwindSafe for SqliteStorage
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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.