file mgr db unit tests and fixes
This commit is contained in:
parent
fa72388a8b
commit
9c9c7cdf8b
@ -106,7 +106,7 @@ auto sqlite_file_mgr_db::add_upload(upload_entry entry) -> bool {
|
||||
}
|
||||
|
||||
auto sqlite_file_mgr_db::add_upload_active(upload_active_entry entry) -> bool {
|
||||
return utils::db::sqlite::db_insert{*db_, upload_table}
|
||||
return utils::db::sqlite::db_insert{*db_, upload_active_table}
|
||||
.or_replace()
|
||||
.column_value("api_path", entry.api_path)
|
||||
.column_value("source_path", entry.source_path)
|
||||
|
@ -424,7 +424,7 @@ void file_manager::queue_upload(const std::string &api_path,
|
||||
|
||||
remove_upload(api_path, true);
|
||||
|
||||
if (mgr_db_->add_upload({
|
||||
if (mgr_db_->add_upload(i_file_mgr_db::upload_entry{
|
||||
api_path,
|
||||
utils::time::get_time_now(),
|
||||
source_path,
|
||||
@ -499,7 +499,7 @@ void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
|
||||
function_name, api_path, api_error::error, "failed to remove upload");
|
||||
}
|
||||
|
||||
auto removed = not mgr_db_->remove_upload_active(api_path);
|
||||
auto removed = mgr_db_->remove_upload_active(api_path);
|
||||
if (not removed) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, api_path, api_error::error,
|
||||
@ -796,7 +796,7 @@ void file_manager::store_resume(const i_open_file &file) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mgr_db_->add_resume({
|
||||
if (mgr_db_->add_resume(i_file_mgr_db::resume_entry{
|
||||
file.get_api_path(),
|
||||
file.get_chunk_size(),
|
||||
file.get_read_state(),
|
||||
@ -905,10 +905,11 @@ void file_manager::upload_handler() {
|
||||
upload_lookup_[fsi.api_path] =
|
||||
std::make_unique<upload>(fsi, provider_);
|
||||
if (mgr_db_->remove_upload(entry->api_path)) {
|
||||
if (not mgr_db_->add_upload_active({
|
||||
entry->api_path,
|
||||
entry->source_path,
|
||||
})) {
|
||||
if (not mgr_db_->add_upload_active(
|
||||
i_file_mgr_db::upload_active_entry{
|
||||
entry->api_path,
|
||||
entry->source_path,
|
||||
})) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, entry->api_path, entry->source_path,
|
||||
"failed to add to upload_active table");
|
||||
|
Loading…
x
Reference in New Issue
Block a user