SqliteStorage

Struct SqliteStorage 

Source
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

Source

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.

Source

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
Source

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

Source§

type Error = StorageError

The error type returned by storage operations.
Source§

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>

Retrieve data by key. Read more
Source§

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>

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>

Find resources by a specific attribute value. Read more
Source§

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>

Count the total number of resources matching a prefix. Read more
Source§

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>

List all resource types for a specific tenant. Read more
Source§

async fn list_all_resource_types(&self) -> Result<Vec<String>, Self::Error>

List all resource types across all tenants. Read more
Source§

async fn clear(&self) -> Result<(), Self::Error>

Clear all data from storage. Read more
Source§

async fn stats(&self) -> Result<StorageStats, Self::Error>

Get storage statistics for debugging and monitoring. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> TenantValidator for T

Source§

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>

Validate that the context is for single-tenant operation.
Source§

fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>

Extract tenant context or return error for multi-tenant operations.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,