file mgr db unit tests and fixes
This commit is contained in:
parent
3425619773
commit
7415f562ff
@ -19,8 +19,8 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_DB_RDB_FILE_MGR_DB_HPP_
|
||||
#define REPERTORY_INCLUDE_DB_RDB_FILE_MGR_DB_HPP_
|
||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_MGR_DB_HPP_
|
||||
#define REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_MGR_DB_HPP_
|
||||
|
||||
#include "db/i_file_mgr_db.hpp"
|
||||
|
||||
@ -62,37 +62,37 @@ public:
|
||||
|
||||
[[nodiscard]] auto add_upload(upload_entry entry) -> bool override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
add_upload_active(upload_active_entry entry) -> bool override;
|
||||
[[nodiscard]] auto add_upload_active(upload_active_entry entry)
|
||||
-> bool override;
|
||||
|
||||
void clear() override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_next_upload() const -> std::optional<upload_entry> override;
|
||||
[[nodiscard]] auto get_next_upload() const
|
||||
-> std::optional<upload_entry> override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_resume_list() const -> std::vector<resume_entry> override;
|
||||
[[nodiscard]] auto get_resume_list() const
|
||||
-> std::vector<resume_entry> override;
|
||||
|
||||
[[nodiscard]] auto get_upload(const std::string &api_path) const
|
||||
-> std::optional<upload_entry> override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_upload_active_list() const -> std::vector<upload_active_entry> override;
|
||||
[[nodiscard]] auto get_upload_active_list() const
|
||||
-> std::vector<upload_active_entry> override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
remove_resume(const std::string &api_path) -> bool override;
|
||||
[[nodiscard]] auto remove_resume(const std::string &api_path)
|
||||
-> bool override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
remove_upload(const std::string &api_path) -> bool override;
|
||||
[[nodiscard]] auto remove_upload(const std::string &api_path)
|
||||
-> bool override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
remove_upload_active(const std::string &api_path) -> bool override;
|
||||
[[nodiscard]] auto remove_upload_active(const std::string &api_path)
|
||||
-> bool override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
rename_resume(const std::string &from_api_path,
|
||||
const std::string &to_api_path) -> bool override;
|
||||
[[nodiscard]] auto rename_resume(const std::string &from_api_path,
|
||||
const std::string &to_api_path)
|
||||
-> bool override;
|
||||
};
|
||||
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_DB_RDB_FILE_MGR_DB_HPP_
|
||||
#endif // REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_MGR_DB_HPP_
|
@ -19,8 +19,8 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_DB_RDB_META_DB_HPP_
|
||||
#define REPERTORY_INCLUDE_DB_RDB_META_DB_HPP_
|
||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_RDB_META_DB_HPP_
|
||||
#define REPERTORY_INCLUDE_DB_IMPL_RDB_META_DB_HPP_
|
||||
|
||||
#include "db/i_meta_db.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
@ -109,4 +109,4 @@ public:
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_DB_RDB_META_DB_HPP_
|
||||
#endif // REPERTORY_INCLUDE_DB_IMPL_RDB_META_DB_HPP_
|
@ -19,8 +19,8 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_DB_SQLITE_FILE_MGR_DB_HPP_
|
||||
#define REPERTORY_INCLUDE_DB_SQLITE_FILE_MGR_DB_HPP_
|
||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_MGR_DB_HPP_
|
||||
#define REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_MGR_DB_HPP_
|
||||
|
||||
#include "db/i_file_mgr_db.hpp"
|
||||
#include "utils/db/sqlite/db_common.hpp"
|
||||
@ -46,37 +46,37 @@ public:
|
||||
|
||||
[[nodiscard]] auto add_upload(upload_entry entry) -> bool override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
add_upload_active(upload_active_entry entry) -> bool override;
|
||||
[[nodiscard]] auto add_upload_active(upload_active_entry entry)
|
||||
-> bool override;
|
||||
|
||||
void clear() override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_next_upload() const -> std::optional<upload_entry> override;
|
||||
[[nodiscard]] auto get_next_upload() const
|
||||
-> std::optional<upload_entry> override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_resume_list() const -> std::vector<resume_entry> override;
|
||||
[[nodiscard]] auto get_resume_list() const
|
||||
-> std::vector<resume_entry> override;
|
||||
|
||||
[[nodiscard]] auto get_upload(const std::string &api_path) const
|
||||
-> std::optional<upload_entry> override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_upload_active_list() const -> std::vector<upload_active_entry> override;
|
||||
[[nodiscard]] auto get_upload_active_list() const
|
||||
-> std::vector<upload_active_entry> override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
remove_resume(const std::string &api_path) -> bool override;
|
||||
[[nodiscard]] auto remove_resume(const std::string &api_path)
|
||||
-> bool override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
remove_upload(const std::string &api_path) -> bool override;
|
||||
[[nodiscard]] auto remove_upload(const std::string &api_path)
|
||||
-> bool override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
remove_upload_active(const std::string &api_path) -> bool override;
|
||||
[[nodiscard]] auto remove_upload_active(const std::string &api_path)
|
||||
-> bool override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
rename_resume(const std::string &from_api_path,
|
||||
const std::string &to_api_path) -> bool override;
|
||||
[[nodiscard]] auto rename_resume(const std::string &from_api_path,
|
||||
const std::string &to_api_path)
|
||||
-> bool override;
|
||||
};
|
||||
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_DB_SQLITE_FILE_MGR_DB_HPP_
|
||||
#endif // REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_MGR_DB_HPP_
|
@ -19,8 +19,8 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_DB_SQLITE_META_DB_HPP_
|
||||
#define REPERTORY_INCLUDE_DB_SQLITE_META_DB_HPP_
|
||||
#ifndef REPERTORY_INCLUDE_DB_IMPL_SQLITE_META_DB_HPP_
|
||||
#define REPERTORY_INCLUDE_DB_IMPL_SQLITE_META_DB_HPP_
|
||||
|
||||
#include "db/i_meta_db.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
@ -94,4 +94,4 @@ public:
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_DB_SQLITE_META_DB_HPP_
|
||||
#endif // REPERTORY_INCLUDE_DB_IMPL_SQLITE_META_DB_HPP_
|
@ -23,8 +23,8 @@
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "db/i_file_mgr_db.hpp"
|
||||
#include "db/rdb_file_mgr_db.hpp"
|
||||
#include "db/sqlite_file_mgr_db.hpp"
|
||||
#include "db/impl/rdb_file_mgr_db.hpp"
|
||||
#include "db/impl/sqlite_file_mgr_db.hpp"
|
||||
|
||||
namespace repertory {
|
||||
auto create_file_mgr_db(const app_config &cfg)
|
||||
|
@ -19,7 +19,7 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#include "db/rdb_file_mgr_db.hpp"
|
||||
#include "db/impl/rdb_file_mgr_db.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "types/startup_exception.hpp"
|
@ -19,7 +19,7 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#include "db/rdb_meta_db.hpp"
|
||||
#include "db/impl/rdb_meta_db.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "types/startup_exception.hpp"
|
@ -19,7 +19,7 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#include "db/sqlite_file_mgr_db.hpp"
|
||||
#include "db/impl/sqlite_file_mgr_db.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "utils/config.hpp"
|
@ -19,7 +19,7 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#include "db/sqlite_meta_db.hpp"
|
||||
#include "db/impl/sqlite_meta_db.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "utils/db/sqlite/db_common.hpp"
|
@ -22,8 +22,8 @@
|
||||
#include "db/meta_db.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "db/rdb_meta_db.hpp"
|
||||
#include "db/sqlite_meta_db.hpp"
|
||||
#include "db/impl/rdb_meta_db.hpp"
|
||||
#include "db/impl/sqlite_meta_db.hpp"
|
||||
|
||||
namespace repertory {
|
||||
auto create_meta_db(const app_config &cfg) -> std::unique_ptr<i_meta_db> {
|
||||
|
@ -501,9 +501,9 @@ void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
|
||||
|
||||
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,
|
||||
"failed to remove from upload_active table");
|
||||
utils::error::raise_api_path_error(function_name, api_path,
|
||||
api_error::error,
|
||||
"failed to remove active upload");
|
||||
}
|
||||
|
||||
if (upload_lookup_.find(api_path) != upload_lookup_.end()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user