mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-02-15 10:03:26 -05:00
chore(ffi): Restore ClientBuilder::session_paths as #[deprecated].
This method restores and marks `ClientBuilder::session_paths` as deprecated.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
// Allow UniFFI to use methods marked as `#[deprecated]`.
|
||||
#![allow(deprecated)]
|
||||
|
||||
use std::{num::NonZeroUsize, sync::Arc, time::Duration};
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
@@ -526,6 +529,20 @@ impl ClientBuilder {
|
||||
builder.store = Some(StoreBuilder::Sqlite(unwrap_or_clone_arc(config)));
|
||||
Arc::new(builder)
|
||||
}
|
||||
|
||||
/// Sets the paths that the client will use to store its data and caches
|
||||
/// with SQLite.
|
||||
///
|
||||
/// Both paths **must** be unique per session as the SDK
|
||||
/// stores aren't capable of handling multiple users, however it is
|
||||
/// valid to use the same path for both stores on a single session.
|
||||
#[deprecated = "Use `ClientBuilder::session_store_with_sqlite` instead"]
|
||||
pub fn session_paths(self: Arc<Self>, data_path: String, cache_path: String) -> Arc<Self> {
|
||||
let mut builder = unwrap_or_clone_arc(self);
|
||||
builder.store =
|
||||
Some(StoreBuilder::Sqlite(store::SqliteStoreBuilder::raw_new(data_path, cache_path)));
|
||||
Arc::new(builder)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "indexeddb")]
|
||||
|
||||
@@ -56,6 +56,19 @@ mod sqlite {
|
||||
system_is_memory_constrained: bool,
|
||||
}
|
||||
|
||||
impl SqliteStoreBuilder {
|
||||
pub(crate) fn raw_new(data_path: String, cache_path: String) -> Self {
|
||||
Self {
|
||||
paths: StorePaths { data_path, cache_path },
|
||||
passphrase: Zeroizing::new(None),
|
||||
pool_max_size: None,
|
||||
cache_size: None,
|
||||
journal_size_limit: None,
|
||||
system_is_memory_constrained: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[matrix_sdk_ffi_macros::export]
|
||||
impl SqliteStoreBuilder {
|
||||
/// Construct a [`SqliteStoreBuilder`] and set the paths that the client
|
||||
@@ -66,14 +79,7 @@ mod sqlite {
|
||||
/// same path for both stores on a single session.
|
||||
#[uniffi::constructor]
|
||||
pub fn new(data_path: String, cache_path: String) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
paths: SessionPaths { data_path, cache_path },
|
||||
passphrase: Zeroizing::new(None),
|
||||
pool_max_size: None,
|
||||
cache_size: None,
|
||||
journal_size_limit: None,
|
||||
system_is_memory_constrained: false,
|
||||
})
|
||||
Arc::new(Self::raw_new(data_path, cache_path))
|
||||
}
|
||||
|
||||
/// Set the passphrase for the stores.
|
||||
|
||||
Reference in New Issue
Block a user