Add TdDb::Parameters.

This commit is contained in:
levlam 2023-03-13 22:29:56 +03:00
parent 03e7c4ce7c
commit 47c4d50907
8 changed files with 168 additions and 144 deletions

View File

@ -748,7 +748,6 @@ set(TDLIB_SOURCE
td/telegram/Td.h
td/telegram/TdCallback.h
td/telegram/TdDb.h
td/telegram/TdParameters.h
td/telegram/TermsOfService.h
td/telegram/ThemeManager.h
td/telegram/TopDialogCategory.h

View File

@ -85,9 +85,7 @@ struct ServerTimeDiff {
}
};
Status Global::init(const TdParameters &parameters, ActorId<Td> td, unique_ptr<TdDb> td_db_ptr) {
parameters_ = parameters;
Status Global::init(ActorId<Td> td, unique_ptr<TdDb> td_db_ptr) {
gc_scheduler_id_ = min(Scheduler::instance()->sched_id() + 2, Scheduler::instance()->sched_count() - 1);
slow_net_scheduler_id_ = min(Scheduler::instance()->sched_id() + 3, Scheduler::instance()->sched_count() - 1);
@ -135,6 +133,30 @@ Status Global::init(const TdParameters &parameters, ActorId<Td> td, unique_ptr<T
return Status::OK();
}
Slice Global::get_dir() const {
return td_db_->get_database_directory();
}
Slice Global::get_files_dir() const {
return td_db_->get_files_directory();
}
bool Global::is_test_dc() const {
return td_db_->is_test_dc();
}
bool Global::use_file_database() const {
return td_db_->use_file_database();
}
bool Global::use_chat_info_database() const {
return td_db_->use_chat_info_database();
}
bool Global::use_message_database() const {
return td_db_->use_message_database();
}
int32 Global::get_retry_after(int32 error_code, Slice error_message) {
if (error_code != 429) {
return 0;

View File

@ -10,7 +10,6 @@
#include "td/telegram/net/DcId.h"
#include "td/telegram/net/MtprotoHeader.h"
#include "td/telegram/net/NetQueryCreator.h"
#include "td/telegram/TdParameters.h"
#include "td/net/NetStats.h"
@ -92,23 +91,20 @@ class Global final : public ActorContext {
void close_all(Promise<> on_finished);
void close_and_destroy_all(Promise<> on_finished);
Status init(const TdParameters &parameters, ActorId<Td> td, unique_ptr<TdDb> td_db_ptr) TD_WARN_UNUSED_RESULT;
Status init(ActorId<Td> td, unique_ptr<TdDb> td_db_ptr) TD_WARN_UNUSED_RESULT;
Slice get_dir() const;
Slice get_dir() const {
return parameters_.database_directory;
}
Slice get_secure_files_dir() const {
if (store_all_files_in_files_directory_) {
return get_files_dir();
}
return get_dir();
}
Slice get_files_dir() const {
return parameters_.files_directory;
}
bool is_test_dc() const {
return parameters_.use_test_dc;
}
Slice get_files_dir() const;
bool is_test_dc() const;
NetQueryCreator &net_query_creator() {
return *net_query_creator_.get();
@ -394,17 +390,11 @@ class Global final : public ActorContext {
return mtproto_header_ != nullptr;
}
bool use_file_database() const {
return parameters_.use_file_db;
}
bool use_file_database() const;
bool use_chat_info_database() const {
return parameters_.use_chat_info_db;
}
bool use_chat_info_database() const;
bool use_message_database() const {
return parameters_.use_message_db;
}
bool use_message_database() const;
int32 get_gc_scheduler_id() const {
return gc_scheduler_id_;
@ -528,7 +518,6 @@ class Global final : public ActorContext {
OptionManager *option_manager_ = nullptr;
TdParameters parameters_;
int32 gc_scheduler_id_ = 0;
int32 slow_net_scheduler_id_ = 0;

View File

@ -2957,23 +2957,23 @@ void Td::run_request(uint64 id, tl_object_ptr<td_api::Function> function) {
case State::WaitParameters: {
switch (function_id) {
case td_api::setTdlibParameters::ID: {
auto parameters = move_tl_object_as<td_api::setTdlibParameters>(function);
auto database_encryption_key = as_db_key(std::move(parameters->database_encryption_key_));
auto r_parameters = set_parameters(std::move(parameters));
auto r_parameters = get_parameters(move_tl_object_as<td_api::setTdlibParameters>(function));
if (r_parameters.is_error()) {
return send_closure(actor_id(this), &Td::send_error, id, r_parameters.move_as_error());
}
auto parameters = r_parameters.move_as_ok();
VLOG(td_init) << "Begin to open database";
set_parameters_request_id_ = id;
can_ignore_background_updates_ = !r_parameters.ok().use_file_db && !r_parameters.ok().use_secret_chats;
can_ignore_background_updates_ =
!parameters.second.use_file_database_ && !parameters.second.use_chat_info_database_ &&
!parameters.second.use_message_database_ && !parameters.first.use_secret_chats_;
auto promise =
PromiseCreator::lambda([actor_id = actor_id(this)](Result<TdDb::OpenedDatabase> r_opened_database) {
send_closure(actor_id, &Td::init, std::move(r_opened_database));
});
return TdDb::open(get_database_scheduler_id(), r_parameters.move_as_ok(), std::move(database_encryption_key),
std::move(promise));
auto promise = PromiseCreator::lambda([actor_id = actor_id(this), parameters = std::move(parameters.first)](
Result<TdDb::OpenedDatabase> r_opened_database) mutable {
send_closure(actor_id, &Td::init, std::move(parameters), std::move(r_opened_database));
});
return TdDb::open(get_database_scheduler_id(), std::move(parameters.second), std::move(promise));
}
default:
if (is_preinitialization_request(function_id)) {
@ -3545,7 +3545,7 @@ void Td::finish_set_parameters() {
CHECK(pending_set_parameters_requests_.size() < requests.size());
}
void Td::init(Result<TdDb::OpenedDatabase> r_opened_database) {
void Td::init(Parameters parameters, Result<TdDb::OpenedDatabase> r_opened_database) {
CHECK(set_parameters_request_id_ != 0);
if (r_opened_database.is_error()) {
LOG(WARNING) << "Failed to open database: " << r_opened_database.error();
@ -3554,16 +3554,14 @@ void Td::init(Result<TdDb::OpenedDatabase> r_opened_database) {
}
auto events = r_opened_database.move_as_ok();
LOG(INFO) << "Successfully inited database in " << tag("database_directory", events.parameters.database_directory)
<< " and " << tag("files_directory", events.parameters.files_directory);
VLOG(td_init) << "Successfully inited database";
G()->init(events.parameters, actor_id(this), std::move(events.database)).ensure();
G()->init(actor_id(this), std::move(events.database)).ensure();
init_options_and_network();
option_manager_->set_option_boolean("use_storage_optimizer", events.parameters.enable_storage_optimizer);
option_manager_->set_option_boolean("ignore_file_names", events.parameters.ignore_file_names);
option_manager_->set_option_boolean("use_storage_optimizer", parameters.enable_storage_optimizer_);
option_manager_->set_option_boolean("ignore_file_names", parameters.ignore_file_names_);
// we need to process td_api::getOption along with td_api::setOption for consistency
// we need to process td_api::setOption before managers and MTProto header are created,
@ -3627,8 +3625,7 @@ void Td::init(Result<TdDb::OpenedDatabase> r_opened_database) {
});
VLOG(td_init) << "Create AuthManager";
auth_manager_ =
td::make_unique<AuthManager>(events.parameters.api_id, events.parameters.api_hash, create_reference());
auth_manager_ = td::make_unique<AuthManager>(parameters.api_id_, parameters.api_hash_, create_reference());
auth_manager_actor_ = register_actor("AuthManager", auth_manager_.get());
G()->set_auth_manager(auth_manager_actor_.get());
@ -3637,7 +3634,7 @@ void Td::init(Result<TdDb::OpenedDatabase> r_opened_database) {
init_managers();
secret_chats_manager_ =
create_actor<SecretChatsManager>("SecretChatsManager", create_reference(), events.parameters.use_secret_chats);
create_actor<SecretChatsManager>("SecretChatsManager", create_reference(), parameters.use_secret_chats_);
G()->set_secret_chats_manager(secret_chats_manager_.get());
storage_manager_ = create_actor<StorageManager>("StorageManager", create_reference(), G()->get_gc_scheduler_id());
@ -4078,7 +4075,8 @@ Promise<Unit> Td::create_ok_request_promise(uint64 id) {
static_assert(std::is_same<std::decay_t<decltype(request)>::ReturnType, td_api::object_ptr<td_api::ok>>::value, ""); \
auto promise = create_ok_request_promise(id)
Result<TdParameters> Td::set_parameters(td_api::object_ptr<td_api::setTdlibParameters> parameters) {
Result<std::pair<Td::Parameters, TdDb::Parameters>> Td::get_parameters(
td_api::object_ptr<td_api::setTdlibParameters> parameters) {
VLOG(td_init) << "Begin to set TDLib parameters";
if (!clean_input_string(parameters->api_hash_) || !clean_input_string(parameters->system_language_code_) ||
!clean_input_string(parameters->device_model_) || !clean_input_string(parameters->system_version_) ||
@ -4094,18 +4092,20 @@ Result<TdParameters> Td::set_parameters(td_api::object_ptr<td_api::setTdlibParam
return Status::Error(400, "Valid api_hash must be provided. Can be obtained at https://my.telegram.org");
}
TdParameters result;
result.database_directory = std::move(parameters->database_directory_);
result.files_directory = std::move(parameters->files_directory_);
result.api_id = parameters->api_id_;
result.api_hash = std::move(parameters->api_hash_);
result.use_test_dc = parameters->use_test_dc_;
result.use_file_db = parameters->use_file_database_;
result.use_chat_info_db = parameters->use_chat_info_database_;
result.use_message_db = parameters->use_message_database_;
result.use_secret_chats = parameters->use_secret_chats_;
result.enable_storage_optimizer = parameters->enable_storage_optimizer_;
result.ignore_file_names = parameters->ignore_file_names_;
std::pair<Parameters, TdDb::Parameters> result;
result.first.api_id_ = parameters->api_id_;
result.first.api_hash_ = std::move(parameters->api_hash_);
result.first.use_secret_chats_ = parameters->use_secret_chats_;
result.first.enable_storage_optimizer_ = parameters->enable_storage_optimizer_;
result.first.ignore_file_names_ = parameters->ignore_file_names_;
result.second.encryption_key_ = as_db_key(std::move(parameters->database_encryption_key_));
result.second.database_directory_ = std::move(parameters->database_directory_);
result.second.files_directory_ = std::move(parameters->files_directory_);
result.second.is_test_dc_ = parameters->use_test_dc_;
result.second.use_file_database_ = parameters->use_file_database_;
result.second.use_chat_info_database_ = parameters->use_chat_info_database_;
result.second.use_message_database_ = parameters->use_message_database_;
VLOG(td_init) << "Create MtprotoHeader::Options";
options_.api_id = parameters->api_id_;

View File

@ -14,7 +14,6 @@
#include "td/telegram/td_api.h"
#include "td/telegram/TdCallback.h"
#include "td/telegram/TdDb.h"
#include "td/telegram/TdParameters.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/TermsOfService.h"
@ -1598,9 +1597,19 @@ class Td final : public Actor {
static int32 get_database_scheduler_id();
struct Parameters {
int32 api_id_ = 0;
string api_hash_;
bool use_secret_chats_ = false;
// TODO move to options and remove
bool enable_storage_optimizer_ = false;
bool ignore_file_names_ = false;
};
void finish_set_parameters();
void init(Result<TdDb::OpenedDatabase> r_opened_database);
void init(Parameters parameters, Result<TdDb::OpenedDatabase> r_opened_database);
void init_options_and_network();
@ -1612,7 +1621,8 @@ class Td final : public Actor {
void close_impl(bool destroy_flag);
Result<TdParameters> set_parameters(td_api::object_ptr<td_api::setTdlibParameters> parameters) TD_WARN_UNUSED_RESULT;
Result<std::pair<Parameters, TdDb::Parameters>> get_parameters(
td_api::object_ptr<td_api::setTdlibParameters> parameters) TD_WARN_UNUSED_RESULT;
static td_api::object_ptr<td_api::error> make_error(int32 code, CSlice error) {
return td_api::make_object<td_api::error>(code, error.str());

View File

@ -45,13 +45,13 @@ namespace td {
namespace {
std::string get_binlog_path(const TdParameters &parameters) {
return PSTRING() << parameters.database_directory << "td" << (parameters.use_test_dc ? "_test" : "") << ".binlog";
std::string get_binlog_path(const TdDb::Parameters &parameters) {
return PSTRING() << parameters.database_directory_ << "td" << (parameters.is_test_dc_ ? "_test" : "") << ".binlog";
}
std::string get_sqlite_path(const TdParameters &parameters) {
const string db_name = "db" + (parameters.use_test_dc ? string("_test") : string());
return parameters.database_directory + db_name + ".sqlite";
std::string get_sqlite_path(const TdDb::Parameters &parameters) {
const string db_name = "db" + (parameters.is_test_dc_ ? string("_test") : string());
return parameters.database_directory_ + db_name + ".sqlite";
}
Status init_binlog(Binlog &binlog, string path, BinlogKeyValue<Binlog> &binlog_pmc, BinlogKeyValue<Binlog> &config_pmc,
@ -317,18 +317,18 @@ void TdDb::do_close(Promise<> on_finished, bool destroy_flag) {
lock.set_value(Unit());
}
Status TdDb::init_sqlite(const TdParameters &parameters, const DbKey &key, const DbKey &old_key,
Status TdDb::init_sqlite(const Parameters &parameters, const DbKey &key, const DbKey &old_key,
BinlogKeyValue<Binlog> &binlog_pmc) {
CHECK(!parameters.use_message_db || parameters.use_chat_info_db);
CHECK(!parameters.use_chat_info_db || parameters.use_file_db);
CHECK(!parameters.use_message_database_ || parameters.use_chat_info_database_);
CHECK(!parameters.use_chat_info_database_ || parameters.use_file_database_);
const string sql_database_path = get_sqlite_path(parameters);
bool use_sqlite = parameters.use_file_db;
bool use_file_db = parameters.use_file_db;
bool use_dialog_db = parameters.use_message_db;
bool use_message_thread_db = parameters.use_message_db && false;
bool use_message_db = parameters.use_message_db;
bool use_sqlite = parameters.use_file_database_;
bool use_file_database_ = parameters.use_file_database_;
bool use_dialog_db = parameters.use_message_database_;
bool use_message_thread_db = parameters.use_message_database_ && false;
bool use_message_database_ = parameters.use_message_database_;
if (!use_sqlite) {
SqliteDb::destroy(sql_database_path).ignore();
return Status::OK();
@ -369,14 +369,14 @@ Status TdDb::init_sqlite(const TdParameters &parameters, const DbKey &key, const
}
// init MessageDb
if (use_message_db) {
if (use_message_database_) {
TRY_STATUS(init_message_db(db, user_version));
} else {
TRY_STATUS(drop_message_db(db, user_version));
}
// init filesDb
if (use_file_db) {
if (use_file_database_) {
TRY_STATUS(init_file_db(db, user_version));
} else {
TRY_STATUS(drop_file_db(db, user_version));
@ -425,7 +425,7 @@ Status TdDb::init_sqlite(const TdParameters &parameters, const DbKey &key, const
message_thread_db_async_ = create_message_thread_db_async(message_thread_db_sync_safe_);
}
if (use_message_db) {
if (use_message_database_) {
message_db_sync_safe_ = create_message_db_sync(sql_connection_);
message_db_async_ = create_message_db_async(message_db_sync_safe_);
}
@ -433,13 +433,14 @@ Status TdDb::init_sqlite(const TdParameters &parameters, const DbKey &key, const
return Status::OK();
}
void TdDb::open(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise) {
void TdDb::open(int32 scheduler_id, Parameters parameters, Promise<OpenedDatabase> &&promise) {
Scheduler::instance()->run_on_scheduler(
scheduler_id, [parameters = std::move(parameters), key = std::move(key), promise = std::move(promise)](
Unit) mutable { TdDb::open_impl(std::move(parameters), std::move(key), std::move(promise)); });
scheduler_id, [parameters = std::move(parameters), promise = std::move(promise)](Unit) mutable {
TdDb::open_impl(std::move(parameters), std::move(promise));
});
}
void TdDb::open_impl(TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise) {
void TdDb::open_impl(Parameters parameters, Promise<OpenedDatabase> &&promise) {
TRY_STATUS_PROMISE(promise, check_parameters(parameters));
OpenedDatabase result;
@ -453,10 +454,10 @@ void TdDb::open_impl(TdParameters parameters, DbKey key, Promise<OpenedDatabase>
binlog_pmc->external_init_begin(static_cast<int32>(LogEvent::HandlerType::BinlogPmcMagic));
config_pmc->external_init_begin(static_cast<int32>(LogEvent::HandlerType::ConfigPmcMagic));
bool encrypt_binlog = !key.is_empty();
bool encrypt_binlog = !parameters.encryption_key_.is_empty();
VLOG(td_init) << "Start binlog loading";
TRY_STATUS_PROMISE(
promise, init_binlog(*binlog, get_binlog_path(parameters), *binlog_pmc, *config_pmc, result, std::move(key)));
TRY_STATUS_PROMISE(promise, init_binlog(*binlog, get_binlog_path(parameters), *binlog_pmc, *config_pmc, result,
std::move(parameters.encryption_key_)));
VLOG(td_init) << "Finish binlog loading";
binlog_pmc->external_init_finish(binlog);
@ -464,7 +465,7 @@ void TdDb::open_impl(TdParameters parameters, DbKey key, Promise<OpenedDatabase>
config_pmc->external_init_finish(binlog);
VLOG(td_init) << "Finish initialization of config PMC";
if (parameters.use_file_db && binlog_pmc->get("auth").empty()) {
if (parameters.use_file_database_ && binlog_pmc->get("auth").empty()) {
LOG(INFO) << "Destroy SQLite database, because wasn't authorized yet";
SqliteDb::destroy(get_sqlite_path(parameters)).ignore();
}
@ -531,11 +532,14 @@ void TdDb::open_impl(TdParameters parameters, DbKey key, Promise<OpenedDatabase>
VLOG(td_init) << "Init concurrent_config_pmc";
concurrent_config_pmc->external_init_finish(concurrent_binlog);
LOG(INFO) << "Successfully inited database in directory " << parameters.database_directory_ << " and files directory "
<< parameters.files_directory_;
db->parameters_ = std::move(parameters);
db->binlog_pmc_ = std::move(concurrent_binlog_pmc);
db->config_pmc_ = std::move(concurrent_config_pmc);
db->binlog_ = std::move(concurrent_binlog);
result.parameters = std::move(parameters);
result.database = std::move(db);
promise.set_value(std::move(result));
@ -544,18 +548,15 @@ void TdDb::open_impl(TdParameters parameters, DbKey key, Promise<OpenedDatabase>
TdDb::TdDb() = default;
TdDb::~TdDb() = default;
Status TdDb::check_parameters(TdParameters &parameters) {
if (parameters.database_directory.empty()) {
VLOG(td_init) << "Fix database_directory";
parameters.database_directory = ".";
Status TdDb::check_parameters(Parameters &parameters) {
if (parameters.database_directory_.empty()) {
parameters.database_directory_ = ".";
}
if (parameters.use_message_db && !parameters.use_chat_info_db) {
VLOG(td_init) << "Fix use_chat_info_db";
parameters.use_chat_info_db = true;
if (parameters.use_message_database_ && !parameters.use_chat_info_database_) {
parameters.use_chat_info_database_ = true;
}
if (parameters.use_chat_info_db && !parameters.use_file_db) {
VLOG(td_init) << "Fix use_file_db";
parameters.use_file_db = true;
if (parameters.use_chat_info_database_ && !parameters.use_file_database_) {
parameters.use_file_database_ = true;
}
auto prepare_dir = [](string dir) -> Result<string> {
@ -574,24 +575,24 @@ Status TdDb::check_parameters(TdParameters &parameters) {
return real_dir;
};
auto r_database_directory = prepare_dir(parameters.database_directory);
auto r_database_directory = prepare_dir(parameters.database_directory_);
if (r_database_directory.is_error()) {
VLOG(td_init) << "Invalid database_directory";
return Status::Error(400, PSLICE() << "Can't init database in the directory \"" << parameters.database_directory
VLOG(td_init) << "Invalid database directory";
return Status::Error(400, PSLICE() << "Can't init database in the directory \"" << parameters.database_directory_
<< "\": " << r_database_directory.error());
}
parameters.database_directory = r_database_directory.move_as_ok();
parameters.database_directory_ = r_database_directory.move_as_ok();
if (parameters.files_directory.empty()) {
parameters.files_directory = parameters.database_directory;
if (parameters.files_directory_.empty()) {
parameters.files_directory_ = parameters.database_directory_;
} else {
auto r_files_directory = prepare_dir(parameters.files_directory);
auto r_files_directory = prepare_dir(parameters.files_directory_);
if (r_files_directory.is_error()) {
VLOG(td_init) << "Invalid files_directory";
return Status::Error(400, PSLICE() << "Can't init files directory \"" << parameters.files_directory
VLOG(td_init) << "Invalid files directory";
return Status::Error(400, PSLICE() << "Can't init files directory \"" << parameters.files_directory_
<< "\": " << r_files_directory.error());
}
parameters.files_directory = r_files_directory.move_as_ok();
parameters.files_directory_ = r_files_directory.move_as_ok();
}
return Status::OK();
@ -601,7 +602,7 @@ void TdDb::change_key(DbKey key, Promise<> promise) {
get_binlog()->change_key(std::move(key), std::move(promise));
}
Status TdDb::destroy(const TdParameters &parameters) {
Status TdDb::destroy(const Parameters &parameters) {
SqliteDb::destroy(get_sqlite_path(parameters)).ignore();
Binlog::destroy(get_binlog_path(parameters)).ignore();
return Status::OK();

View File

@ -6,8 +6,6 @@
//
#pragma once
#include "td/telegram/TdParameters.h"
#include "td/db/binlog/BinlogEvent.h"
#include "td/db/binlog/BinlogInterface.h"
#include "td/db/DbKey.h"
@ -50,9 +48,17 @@ class TdDb {
TdDb &operator=(TdDb &&) = delete;
~TdDb();
struct OpenedDatabase {
TdParameters parameters;
struct Parameters {
DbKey encryption_key_;
string database_directory_;
string files_directory_;
bool is_test_dc_ = false;
bool use_file_database_ = false;
bool use_chat_info_database_ = false;
bool use_message_database_ = false;
};
struct OpenedDatabase {
unique_ptr<TdDb> database;
vector<BinlogEvent> to_secret_chats_manager;
@ -69,9 +75,33 @@ class TdDb {
int64 since_last_open = 0;
};
static void open(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise);
static void open(int32 scheduler_id, Parameters parameters, Promise<OpenedDatabase> &&promise);
static Status destroy(const TdParameters &parameters);
static Status destroy(const Parameters &parameters);
Slice get_database_directory() const {
return parameters_.database_directory_;
}
Slice get_files_directory() const {
return parameters_.files_directory_;
}
bool is_test_dc() const {
return parameters_.is_test_dc_;
}
bool use_file_database() const {
return parameters_.use_file_database_;
}
bool use_chat_info_database() const {
return parameters_.use_chat_info_database_;
}
bool use_message_database() const {
return parameters_.use_message_database_;
}
std::shared_ptr<FileDbInterface> get_file_db_shared();
std::shared_ptr<SqliteConnectionSafe> &get_sqlite_connection_safe();
@ -112,6 +142,8 @@ class TdDb {
Result<string> get_stats();
private:
Parameters parameters_;
string sqlite_path_;
std::shared_ptr<SqliteConnectionSafe> sql_connection_;
@ -133,11 +165,11 @@ class TdDb {
std::shared_ptr<BinlogKeyValue<ConcurrentBinlog>> config_pmc_;
std::shared_ptr<ConcurrentBinlog> binlog_;
static void open_impl(TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise);
static void open_impl(Parameters parameters, Promise<OpenedDatabase> &&promise);
static Status check_parameters(TdParameters &parameters);
static Status check_parameters(Parameters &parameters);
Status init_sqlite(const TdParameters &parameters, const DbKey &key, const DbKey &old_key,
Status init_sqlite(const Parameters &parameters, const DbKey &key, const DbKey &old_key,
BinlogKeyValue<Binlog> &binlog_pmc);
void do_close(Promise<> on_finished, bool destroy_flag);

View File

@ -1,29 +0,0 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/utils/common.h"
namespace td {
struct TdParameters {
string database_directory;
string files_directory;
int32 api_id = 0;
string api_hash;
bool use_test_dc = false;
bool use_file_db = false;
bool use_chat_info_db = false;
bool use_message_db = false;
bool use_secret_chats = false;
// TODO move to options
bool enable_storage_optimizer = false;
bool ignore_file_names = false;
};
} // namespace td