Skip to content

Commit fc071ba

Browse files
authored
docs: Various fixes for store-related comments.
- Doc comment for the SQLite-based state store incorrectly referred to it as a "cryptostore". - Consistent capitalisation of SQLite. - Consistent use of indefinite article "an" before SQLite. - Fix line length.
1 parent e4ce179 commit fc071ba

File tree

6 files changed

+32
-32
lines changed

6 files changed

+32
-32
lines changed

crates/matrix-sdk-crypto/src/store/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
//! The storage layer for the [`OlmMachine`] can be customized using a trait.
1818
//! Implementing your own [`CryptoStore`]
1919
//!
20-
//! An in-memory only store is provided as well as a SQLite-based one, depending
21-
//! on your needs and targets a custom store may be implemented, e.g. for
22-
//! `wasm-unknown-unknown` an indexeddb store would be needed
20+
//! An in-memory only store is provided as well as an SQLite-based one,
21+
//! depending on your needs and targets a custom store may be implemented, e.g.
22+
//! for `wasm-unknown-unknown` an indexeddb store would be needed
2323
//!
2424
//! ```
2525
//! # use std::sync::Arc;

crates/matrix-sdk-sqlite/src/crypto_store.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use crate::{
5757
/// The database name.
5858
const DATABASE_NAME: &str = "matrix-sdk-crypto.sqlite3";
5959

60-
/// A sqlite based cryptostore.
60+
/// An SQLite-based crypto store.
6161
#[derive(Clone)]
6262
pub struct SqliteCryptoStore {
6363
store_cipher: Option<Arc<StoreCipher>>,
@@ -76,7 +76,7 @@ impl fmt::Debug for SqliteCryptoStore {
7676
}
7777

7878
impl SqliteCryptoStore {
79-
/// Open the sqlite-based crypto store at the given path using the given
79+
/// Open the SQLite-based crypto store at the given path using the given
8080
/// passphrase to encrypt private data.
8181
pub async fn open(
8282
path: impl AsRef<Path>,
@@ -85,7 +85,7 @@ impl SqliteCryptoStore {
8585
Self::open_with_config(SqliteStoreConfig::new(path).passphrase(passphrase)).await
8686
}
8787

88-
/// Open the sqlite-based crypto store with the config open config.
88+
/// Open the SQLite-based crypto store with the config open config.
8989
pub async fn open_with_config(config: SqliteStoreConfig) -> Result<Self, OpenStoreError> {
9090
let SqliteStoreConfig { path, passphrase, pool_config, runtime_config } = config;
9191

@@ -102,8 +102,8 @@ impl SqliteCryptoStore {
102102
Ok(this)
103103
}
104104

105-
/// Create a sqlite-based crypto store using the given sqlite database pool.
106-
/// The given passphrase will be used to encrypt private data.
105+
/// Create an SQLite-based crypto store using the given SQLite database
106+
/// pool. The given passphrase will be used to encrypt private data.
107107
async fn open_with_pool(
108108
pool: SqlitePool,
109109
passphrase: Option<&str>,

crates/matrix-sdk-sqlite/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use matrix_sdk_crypto::CryptoStoreError;
2222
use thiserror::Error;
2323
use tokio::io;
2424

25-
/// All the errors that can occur when opening a SQLite store.
25+
/// All the errors that can occur when opening an SQLite store.
2626
#[derive(Error, Debug)]
2727
#[non_exhaustive]
2828
pub enum OpenStoreError {

crates/matrix-sdk-sqlite/src/event_cache_store.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! A sqlite-based backend for the [`EventCacheStore`].
15+
//! An SQLite-based backend for the [`EventCacheStore`].
1616
1717
use std::{borrow::Cow, fmt, iter::once, path::Path, sync::Arc};
1818

@@ -81,7 +81,7 @@ const CHUNK_TYPE_EVENT_TYPE_STRING: &str = "E";
8181
/// database.
8282
const CHUNK_TYPE_GAP_TYPE_STRING: &str = "G";
8383

84-
/// A SQLite-based event cache store.
84+
/// An SQLite-based event cache store.
8585
#[derive(Clone)]
8686
pub struct SqliteEventCacheStore {
8787
store_cipher: Option<Arc<StoreCipher>>,
@@ -106,7 +106,7 @@ impl SqliteEventCacheStore {
106106
Self::open_with_config(SqliteStoreConfig::new(path).passphrase(passphrase)).await
107107
}
108108

109-
/// Open the sqlite-based event cache store with the config open config.
109+
/// Open the SQLite-based event cache store with the config open config.
110110
pub async fn open_with_config(config: SqliteStoreConfig) -> Result<Self, OpenStoreError> {
111111
let SqliteStoreConfig { path, passphrase, pool_config, runtime_config } = config;
112112

@@ -178,10 +178,10 @@ impl SqliteEventCacheStore {
178178
async fn acquire(&self) -> Result<SqliteAsyncConn> {
179179
let connection = self.pool.get().await?;
180180

181-
// Per https://www.sqlite.org/foreignkeys.html#fk_enable, foreign key support must be
182-
// enabled on a per-connection basis. Execute it every time we try to get a
183-
// connection, since we can't guarantee a previous connection did enable
184-
// it before.
181+
// Per https://www.sqlite.org/foreignkeys.html#fk_enable, foreign key
182+
// support must be enabled on a per-connection basis. Execute it every
183+
// time we try to get a connection, since we can't guarantee a previous
184+
// connection did enable it before.
185185
connection.execute_batch("PRAGMA foreign_keys = ON;").await?;
186186

187187
Ok(connection)
@@ -1922,7 +1922,7 @@ mod tests {
19221922
assert_eq!(gap.prev_token, "tartiflette");
19231923
});
19241924

1925-
// Check that cascading worked. Yes, sqlite, I doubt you.
1925+
// Check that cascading worked. Yes, SQLite, I doubt you.
19261926
let gaps = store
19271927
.acquire()
19281928
.await
@@ -2188,7 +2188,7 @@ mod tests {
21882188
let chunks = store.load_all_chunks(room_id).await.unwrap();
21892189
assert!(chunks.is_empty());
21902190

2191-
// Check that cascading worked. Yes, sqlite, I doubt you.
2191+
// Check that cascading worked. Yes, SQLite, I doubt you.
21922192
store
21932193
.acquire()
21942194
.await

crates/matrix-sdk-sqlite/src/state_store.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ const DATABASE_NAME: &str = "matrix-sdk-state.sqlite3";
6868

6969
/// Identifier of the latest database version.
7070
///
71-
/// This is used to figure whether the sqlite database requires a migration.
71+
/// This is used to figure whether the SQLite database requires a migration.
7272
/// Every new SQL migration should imply a bump of this number, and changes in
73-
/// the [`SqliteStateStore::run_migrations`] function..
73+
/// the [`SqliteStateStore::run_migrations`] function.
7474
const DATABASE_VERSION: u8 = 12;
7575

76-
/// A sqlite based cryptostore.
76+
/// An SQLite-based state store.
7777
#[derive(Clone)]
7878
pub struct SqliteStateStore {
7979
store_cipher: Option<Arc<StoreCipher>>,
@@ -88,7 +88,7 @@ impl fmt::Debug for SqliteStateStore {
8888
}
8989

9090
impl SqliteStateStore {
91-
/// Open the sqlite-based state store at the given path using the given
91+
/// Open the SQLite-based state store at the given path using the given
9292
/// passphrase to encrypt private data.
9393
pub async fn open(
9494
path: impl AsRef<Path>,
@@ -97,7 +97,7 @@ impl SqliteStateStore {
9797
Self::open_with_config(SqliteStoreConfig::new(path).passphrase(passphrase)).await
9898
}
9999

100-
/// Open the sqlite-based state store with the config open config.
100+
/// Open the SQLite-based state store with the config open config.
101101
pub async fn open_with_config(config: SqliteStoreConfig) -> Result<Self, OpenStoreError> {
102102
let SqliteStoreConfig { path, passphrase, pool_config, runtime_config } = config;
103103

@@ -114,7 +114,7 @@ impl SqliteStateStore {
114114
Ok(this)
115115
}
116116

117-
/// Create a sqlite-based state store using the given sqlite database pool.
117+
/// Create an SQLite-based state store using the given SQLite database pool.
118118
/// The given passphrase will be used to encrypt private data.
119119
async fn open_with_pool(
120120
pool: SqlitePool,
@@ -2200,9 +2200,9 @@ mod encrypted_tests {
22002200
let cache_size =
22012201
conn.query_row("PRAGMA cache_size", (), |row| row.get::<_, i32>(0)).await.unwrap();
22022202

2203-
// The value passed to `SqliteStoreConfig` is in bytes. Check it is converted
2204-
// to kibibytes. Also, it must be a negative value because it _is_ the size in
2205-
// kibibytes, not in page size.
2203+
// The value passed to `SqliteStoreConfig` is in bytes. Check it is
2204+
// converted to kibibytes. Also, it must be a negative value because it
2205+
// _is_ the size in kibibytes, not in page size.
22062206
assert_eq!(cache_size, -(1500 / 1024));
22072207
}
22082208

@@ -2219,8 +2219,8 @@ mod encrypted_tests {
22192219
.await
22202220
.unwrap();
22212221

2222-
// The value passed to `SqliteStoreConfig` is in bytes. It stays in bytes in
2223-
// SQLite.
2222+
// The value passed to `SqliteStoreConfig` is in bytes. It stays in
2223+
// bytes in SQLite.
22242224
assert_eq!(journal_size_limit, 1500);
22252225
}
22262226

crates/matrix-sdk/src/client/builder/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl ClientBuilder {
206206
self
207207
}
208208

209-
/// Set up the store configuration for a SQLite store.
209+
/// Set up the store configuration for an SQLite store.
210210
#[cfg(feature = "sqlite")]
211211
pub fn sqlite_store(mut self, path: impl AsRef<Path>, passphrase: Option<&str>) -> Self {
212212
let sqlite_store_config = SqliteStoreConfig::new(path).passphrase(passphrase);
@@ -216,7 +216,7 @@ impl ClientBuilder {
216216
self
217217
}
218218

219-
/// Set up the store configuration for a SQLite store with cached data
219+
/// Set up the store configuration for an SQLite store with cached data
220220
/// separated out from state/crypto data.
221221
#[cfg(feature = "sqlite")]
222222
pub fn sqlite_store_with_cache_path(
@@ -234,7 +234,7 @@ impl ClientBuilder {
234234
self
235235
}
236236

237-
/// Set up the store configuration for a SQLite store with a store config,
237+
/// Set up the store configuration for an SQLite store with a store config,
238238
/// and with an optional cache data separated out from state/crypto data.
239239
#[cfg(feature = "sqlite")]
240240
pub fn sqlite_store_with_config_and_cache_path(

0 commit comments

Comments
 (0)