From 2bec882c83d98c490e7bfbc3236c92d2a1c3965a Mon Sep 17 00:00:00 2001 From: Michael Goldenberg Date: Tue, 9 Dec 2025 11:56:12 -0500 Subject: [PATCH] feat(indexeddb): add fn to media store builder for prefixing db name Signed-off-by: Michael Goldenberg --- crates/matrix-sdk-indexeddb/src/media_store/builder.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/matrix-sdk-indexeddb/src/media_store/builder.rs b/crates/matrix-sdk-indexeddb/src/media_store/builder.rs index cfc5a1333..4d747096f 100644 --- a/crates/matrix-sdk-indexeddb/src/media_store/builder.rs +++ b/crates/matrix-sdk-indexeddb/src/media_store/builder.rs @@ -44,6 +44,16 @@ impl IndexeddbMediaStoreBuilder { /// [`IndexeddbMediaStore`] pub const DEFAULT_DATABASE_NAME: &'static str = "media"; + /// Create a new [`IndexeddbMediaStoreBuilder`] where the database name is + /// constructed by joining the given prefix with + /// [`Self::DEFAULT_DATABASE_NAME`] and separated by `::`. + pub fn with_prefix(prefix: &str) -> Self { + Self { + database_name: format!("{}::{}", prefix, Self::DEFAULT_DATABASE_NAME), + store_cipher: None, + } + } + /// Sets the name of the IndexedDB database which will be opened. This /// defaults to [`Self::DEFAULT_DATABASE_NAME`]. pub fn database_name(mut self, name: String) -> Self {