Make DbKey required to construct SqliteConnectionSafe.

This commit is contained in:
levlam 2021-09-22 17:20:10 +03:00
parent 2008290425
commit f073c790c5
4 changed files with 4 additions and 4 deletions

View File

@ -188,7 +188,7 @@ class SqliteKeyValueAsyncBench final : public td::Benchmark {
td::string sql_db_name = "testdb.sqlite";
td::SqliteDb::destroy(sql_db_name).ignore();
sql_connection_ = std::make_shared<td::SqliteConnectionSafe>(sql_db_name);
sql_connection_ = std::make_shared<td::SqliteConnectionSafe>(sql_db_name, td::DbKey::empty());
auto &db = sql_connection_->get();
TRY_STATUS(init_db(db));

View File

@ -94,7 +94,7 @@ class MessagesDbBench final : public Benchmark {
auto guard = scheduler_->get_main_guard();
string sql_db_name = "testdb.sqlite";
sql_connection_ = std::make_shared<SqliteConnectionSafe>(sql_db_name);
sql_connection_ = std::make_shared<SqliteConnectionSafe>(sql_db_name, DbKey::empty());
auto &db = sql_connection_->get();
TRY_STATUS(init_db(db));

View File

@ -19,7 +19,7 @@ namespace td {
class SqliteConnectionSafe {
public:
SqliteConnectionSafe() = default;
explicit SqliteConnectionSafe(string path, DbKey key = DbKey::empty(), optional<int32> cipher_version = {});
SqliteConnectionSafe(string path, DbKey key, optional<int32> cipher_version = {});
SqliteDb &get();
void set(SqliteDb &&db);

View File

@ -305,7 +305,7 @@ class SqliteKV {
return 0;
}
Status init(string name) {
auto sql_connection = std::make_shared<SqliteConnectionSafe>(name);
auto sql_connection = std::make_shared<SqliteConnectionSafe>(name, DbKey::empty());
kv_ = std::make_shared<SqliteKeyValueSafe>("kv", sql_connection);
return Status::OK();
}