Remove unused scheduler_id parameters.
This commit is contained in:
parent
32724a5a6c
commit
e43d90c089
@ -104,6 +104,6 @@ std::shared_ptr<DialogDbSyncSafeInterface> create_dialog_db_sync(
|
|||||||
std::shared_ptr<SqliteConnectionSafe> sqlite_connection);
|
std::shared_ptr<SqliteConnectionSafe> sqlite_connection);
|
||||||
|
|
||||||
std::shared_ptr<DialogDbAsyncInterface> create_dialog_db_async(std::shared_ptr<DialogDbSyncSafeInterface> sync_db,
|
std::shared_ptr<DialogDbAsyncInterface> create_dialog_db_async(std::shared_ptr<DialogDbSyncSafeInterface> sync_db,
|
||||||
int32 scheduler_id);
|
int32 scheduler_id = -1);
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -205,6 +205,6 @@ std::shared_ptr<MessagesDbSyncSafeInterface> create_messages_db_sync(
|
|||||||
std::shared_ptr<SqliteConnectionSafe> sqlite_connection);
|
std::shared_ptr<SqliteConnectionSafe> sqlite_connection);
|
||||||
|
|
||||||
std::shared_ptr<MessagesDbAsyncInterface> create_messages_db_async(std::shared_ptr<MessagesDbSyncSafeInterface> sync_db,
|
std::shared_ptr<MessagesDbAsyncInterface> create_messages_db_async(std::shared_ptr<MessagesDbSyncSafeInterface> sync_db,
|
||||||
int32 scheduler_id);
|
int32 scheduler_id = -1);
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -273,7 +273,7 @@ void TdDb::do_close(Promise<> on_finished, bool destroy_flag) {
|
|||||||
lock.set_value(Unit());
|
lock.set_value(Unit());
|
||||||
}
|
}
|
||||||
|
|
||||||
Status TdDb::init_sqlite(int32 scheduler_id, const TdParameters ¶meters, const DbKey &key, const DbKey &old_key,
|
Status TdDb::init_sqlite(const TdParameters ¶meters, const DbKey &key, const DbKey &old_key,
|
||||||
BinlogKeyValue<Binlog> &binlog_pmc) {
|
BinlogKeyValue<Binlog> &binlog_pmc) {
|
||||||
CHECK(!parameters.use_message_db || parameters.use_chat_info_db);
|
CHECK(!parameters.use_message_db || parameters.use_chat_info_db);
|
||||||
CHECK(!parameters.use_chat_info_db || parameters.use_file_db);
|
CHECK(!parameters.use_chat_info_db || parameters.use_file_db);
|
||||||
@ -358,32 +358,31 @@ Status TdDb::init_sqlite(int32 scheduler_id, const TdParameters ¶meters, con
|
|||||||
|
|
||||||
TRY_STATUS(db.exec("COMMIT TRANSACTION"));
|
TRY_STATUS(db.exec("COMMIT TRANSACTION"));
|
||||||
|
|
||||||
file_db_ = create_file_db(sql_connection_, scheduler_id);
|
file_db_ = create_file_db(sql_connection_);
|
||||||
|
|
||||||
common_kv_safe_ = std::make_shared<SqliteKeyValueSafe>("common", sql_connection_);
|
common_kv_safe_ = std::make_shared<SqliteKeyValueSafe>("common", sql_connection_);
|
||||||
common_kv_async_ = create_sqlite_key_value_async(common_kv_safe_, scheduler_id);
|
common_kv_async_ = create_sqlite_key_value_async(common_kv_safe_);
|
||||||
|
|
||||||
if (use_dialog_db) {
|
if (use_dialog_db) {
|
||||||
dialog_db_sync_safe_ = create_dialog_db_sync(sql_connection_);
|
dialog_db_sync_safe_ = create_dialog_db_sync(sql_connection_);
|
||||||
dialog_db_async_ = create_dialog_db_async(dialog_db_sync_safe_, scheduler_id);
|
dialog_db_async_ = create_dialog_db_async(dialog_db_sync_safe_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_downloads_db) {
|
if (use_downloads_db) {
|
||||||
messages_db_sync_safe_ = create_messages_db_sync(sql_connection_);
|
messages_db_sync_safe_ = create_messages_db_sync(sql_connection_);
|
||||||
messages_db_async_ = create_messages_db_async(messages_db_sync_safe_, scheduler_id);
|
messages_db_async_ = create_messages_db_async(messages_db_sync_safe_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TdDb::open(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise) {
|
void TdDb::open(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise) {
|
||||||
Scheduler::instance()->run_on_scheduler(scheduler_id, [parameters = std::move(parameters), key = std::move(key),
|
Scheduler::instance()->run_on_scheduler(
|
||||||
promise = std::move(promise)](Unit) mutable {
|
scheduler_id, [parameters = std::move(parameters), key = std::move(key), promise = std::move(promise)](
|
||||||
TdDb::open_impl(-1, std::move(parameters), std::move(key), std::move(promise));
|
Unit) mutable { TdDb::open_impl(std::move(parameters), std::move(key), std::move(promise)); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TdDb::open_impl(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise) {
|
void TdDb::open_impl(TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise) {
|
||||||
OpenedDatabase result;
|
OpenedDatabase result;
|
||||||
|
|
||||||
// Init pmc
|
// Init pmc
|
||||||
@ -427,7 +426,7 @@ void TdDb::open_impl(int32 scheduler_id, TdParameters parameters, DbKey key, Pro
|
|||||||
}
|
}
|
||||||
VLOG(td_init) << "Start to init database";
|
VLOG(td_init) << "Start to init database";
|
||||||
auto db = make_unique<TdDb>();
|
auto db = make_unique<TdDb>();
|
||||||
auto init_sqlite_status = db->init_sqlite(scheduler_id, parameters, new_sqlite_key, old_sqlite_key, *binlog_pmc);
|
auto init_sqlite_status = db->init_sqlite(parameters, new_sqlite_key, old_sqlite_key, *binlog_pmc);
|
||||||
VLOG(td_init) << "Finish to init database";
|
VLOG(td_init) << "Finish to init database";
|
||||||
if (init_sqlite_status.is_error()) {
|
if (init_sqlite_status.is_error()) {
|
||||||
LOG(ERROR) << "Destroy bad SQLite database because of " << init_sqlite_status;
|
LOG(ERROR) << "Destroy bad SQLite database because of " << init_sqlite_status;
|
||||||
@ -435,7 +434,7 @@ void TdDb::open_impl(int32 scheduler_id, TdParameters parameters, DbKey key, Pro
|
|||||||
db->sql_connection_->get().close();
|
db->sql_connection_->get().close();
|
||||||
}
|
}
|
||||||
SqliteDb::destroy(get_sqlite_path(parameters)).ignore();
|
SqliteDb::destroy(get_sqlite_path(parameters)).ignore();
|
||||||
TRY_STATUS_PROMISE(promise, db->init_sqlite(scheduler_id, parameters, new_sqlite_key, old_sqlite_key, *binlog_pmc));
|
TRY_STATUS_PROMISE(promise, db->init_sqlite(parameters, new_sqlite_key, old_sqlite_key, *binlog_pmc));
|
||||||
}
|
}
|
||||||
if (drop_sqlite_key) {
|
if (drop_sqlite_key) {
|
||||||
binlog_pmc->erase("sqlite_key");
|
binlog_pmc->erase("sqlite_key");
|
||||||
@ -458,7 +457,7 @@ void TdDb::open_impl(int32 scheduler_id, TdParameters parameters, DbKey key, Pro
|
|||||||
|
|
||||||
CHECK(binlog_ptr != nullptr);
|
CHECK(binlog_ptr != nullptr);
|
||||||
VLOG(td_init) << "Create concurrent_binlog";
|
VLOG(td_init) << "Create concurrent_binlog";
|
||||||
auto concurrent_binlog = std::make_shared<ConcurrentBinlog>(unique_ptr<Binlog>(binlog_ptr), scheduler_id);
|
auto concurrent_binlog = std::make_shared<ConcurrentBinlog>(unique_ptr<Binlog>(binlog_ptr));
|
||||||
|
|
||||||
VLOG(td_init) << "Init concurrent_binlog_pmc";
|
VLOG(td_init) << "Init concurrent_binlog_pmc";
|
||||||
concurrent_binlog_pmc->external_init_finish(concurrent_binlog);
|
concurrent_binlog_pmc->external_init_finish(concurrent_binlog);
|
||||||
|
@ -124,11 +124,11 @@ class TdDb {
|
|||||||
std::shared_ptr<BinlogKeyValue<ConcurrentBinlog>> config_pmc_;
|
std::shared_ptr<BinlogKeyValue<ConcurrentBinlog>> config_pmc_;
|
||||||
std::shared_ptr<ConcurrentBinlog> binlog_;
|
std::shared_ptr<ConcurrentBinlog> binlog_;
|
||||||
|
|
||||||
static void open_impl(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise);
|
static void open_impl(TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise);
|
||||||
|
|
||||||
static void check_parameters_impl(TdParameters parameters, Promise<CheckedParameters> promise);
|
static void check_parameters_impl(TdParameters parameters, Promise<CheckedParameters> promise);
|
||||||
|
|
||||||
Status init_sqlite(int32 scheduler_id, const TdParameters ¶meters, const DbKey &key, const DbKey &old_key,
|
Status init_sqlite(const TdParameters ¶meters, const DbKey &key, const DbKey &old_key,
|
||||||
BinlogKeyValue<Binlog> &binlog_pmc);
|
BinlogKeyValue<Binlog> &binlog_pmc);
|
||||||
|
|
||||||
void do_close(Promise<> on_finished, bool destroy_flag);
|
void do_close(Promise<> on_finished, bool destroy_flag);
|
||||||
|
Loading…
Reference in New Issue
Block a user