docs(sled): fixing examples and utils

This commit is contained in:
Benjamin Kampmann
2022-07-21 13:18:15 +02:00
parent 60eef8967f
commit 2ffaaeeae2
3 changed files with 11 additions and 7 deletions

View File

@@ -49,13 +49,13 @@ async fn login_and_sync(
// The location to save files to
let mut home = dirs::home_dir().expect("no home directory found");
home.push("autojoin_bot");
let state_store = matrix_sdk_sled::StateStore::open_with_path(home)?;
let state_store = matrix_sdk_sled::SledStateStoreBuilder::default().path(home).build()?;
client_builder = client_builder.state_store(state_store);
}
#[cfg(feature = "indexeddb")]
{
let state_store = matrix_sdk_indexeddb::StateStore::open();
let state_store = matrix_sdk_indexeddb::StateStoreBuilder::default().build()?;
client_builder = client_builder.state_store(state_store);
}

View File

@@ -44,13 +44,13 @@ async fn login_and_sync(
// The location to save files to
let mut home = dirs::home_dir().expect("no home directory found");
home.push("party_bot");
let state_store = matrix_sdk_sled::StateStore::open_with_path(home)?;
let state_store = matrix_sdk_sled::SledStateStoreBuilder::default().path(home).build()?;
client_builder = client_builder.state_store(state_store);
}
#[cfg(feature = "indexeddb")]
{
let state_store = matrix_sdk_indexeddb::StateStore::open();
let state_store = matrix_sdk_indexeddb::StateStoreBuilder::default().build().await?;
client_builder = client_builder.state_store(state_store);
}

View File

@@ -4,7 +4,7 @@ use atty::Stream;
use clap::{Arg, ArgMatches, Command as Argparse};
use futures::executor::block_on;
use matrix_sdk_base::RoomInfo;
use matrix_sdk_sled::StateStore;
use matrix_sdk_sled::{SledStateStoreBuilder, StateStore};
use ruma::{events::StateEventType, OwnedRoomId, OwnedUserId, RoomId};
use rustyline::{
completion::{Completer, Pair},
@@ -202,8 +202,12 @@ impl Printer {
impl Inspector {
fn new(database_path: &str, json: bool, color: bool) -> Self {
let printer = Printer::new(json, color);
let store =
Arc::new(StateStore::open_with_path(database_path).expect("Can't open sled database"));
let store = Arc::new(
SledStateStoreBuilder::default()
.path(database_path.into())
.build()
.expect("Can't open sled database"),
);
Self { store, printer }
}