file mgr db unit tests and fixes

This commit is contained in:
Scott E. Graves 2024-12-09 13:38:05 -06:00
parent 3425619773
commit 7415f562ff
11 changed files with 57 additions and 57 deletions

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef REPERTORY_INCLUDE_DB_RDB_FILE_MGR_DB_HPP_ #ifndef REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_MGR_DB_HPP_
#define REPERTORY_INCLUDE_DB_RDB_FILE_MGR_DB_HPP_ #define REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_MGR_DB_HPP_
#include "db/i_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(upload_entry entry) -> bool override;
[[nodiscard]] auto [[nodiscard]] auto add_upload_active(upload_active_entry entry)
add_upload_active(upload_active_entry entry) -> bool override; -> bool override;
void clear() override; void clear() override;
[[nodiscard]] auto [[nodiscard]] auto get_next_upload() const
get_next_upload() const -> std::optional<upload_entry> override; -> std::optional<upload_entry> override;
[[nodiscard]] auto [[nodiscard]] auto get_resume_list() const
get_resume_list() const -> std::vector<resume_entry> override; -> std::vector<resume_entry> override;
[[nodiscard]] auto get_upload(const std::string &api_path) const [[nodiscard]] auto get_upload(const std::string &api_path) const
-> std::optional<upload_entry> override; -> std::optional<upload_entry> override;
[[nodiscard]] auto [[nodiscard]] auto get_upload_active_list() const
get_upload_active_list() const -> std::vector<upload_active_entry> override; -> std::vector<upload_active_entry> override;
[[nodiscard]] auto [[nodiscard]] auto remove_resume(const std::string &api_path)
remove_resume(const std::string &api_path) -> bool override; -> bool override;
[[nodiscard]] auto [[nodiscard]] auto remove_upload(const std::string &api_path)
remove_upload(const std::string &api_path) -> bool override; -> bool override;
[[nodiscard]] auto [[nodiscard]] auto remove_upload_active(const std::string &api_path)
remove_upload_active(const std::string &api_path) -> bool override; -> bool override;
[[nodiscard]] auto [[nodiscard]] auto rename_resume(const std::string &from_api_path,
rename_resume(const std::string &from_api_path, const std::string &to_api_path)
const std::string &to_api_path) -> bool override; -> bool override;
}; };
} // namespace repertory } // namespace repertory
#endif // REPERTORY_INCLUDE_DB_RDB_FILE_MGR_DB_HPP_ #endif // REPERTORY_INCLUDE_DB_IMPL_RDB_FILE_MGR_DB_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef REPERTORY_INCLUDE_DB_RDB_META_DB_HPP_ #ifndef REPERTORY_INCLUDE_DB_IMPL_RDB_META_DB_HPP_
#define REPERTORY_INCLUDE_DB_RDB_META_DB_HPP_ #define REPERTORY_INCLUDE_DB_IMPL_RDB_META_DB_HPP_
#include "db/i_meta_db.hpp" #include "db/i_meta_db.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -109,4 +109,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // REPERTORY_INCLUDE_DB_RDB_META_DB_HPP_ #endif // REPERTORY_INCLUDE_DB_IMPL_RDB_META_DB_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef REPERTORY_INCLUDE_DB_SQLITE_FILE_MGR_DB_HPP_ #ifndef REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_MGR_DB_HPP_
#define REPERTORY_INCLUDE_DB_SQLITE_FILE_MGR_DB_HPP_ #define REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_MGR_DB_HPP_
#include "db/i_file_mgr_db.hpp" #include "db/i_file_mgr_db.hpp"
#include "utils/db/sqlite/db_common.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(upload_entry entry) -> bool override;
[[nodiscard]] auto [[nodiscard]] auto add_upload_active(upload_active_entry entry)
add_upload_active(upload_active_entry entry) -> bool override; -> bool override;
void clear() override; void clear() override;
[[nodiscard]] auto [[nodiscard]] auto get_next_upload() const
get_next_upload() const -> std::optional<upload_entry> override; -> std::optional<upload_entry> override;
[[nodiscard]] auto [[nodiscard]] auto get_resume_list() const
get_resume_list() const -> std::vector<resume_entry> override; -> std::vector<resume_entry> override;
[[nodiscard]] auto get_upload(const std::string &api_path) const [[nodiscard]] auto get_upload(const std::string &api_path) const
-> std::optional<upload_entry> override; -> std::optional<upload_entry> override;
[[nodiscard]] auto [[nodiscard]] auto get_upload_active_list() const
get_upload_active_list() const -> std::vector<upload_active_entry> override; -> std::vector<upload_active_entry> override;
[[nodiscard]] auto [[nodiscard]] auto remove_resume(const std::string &api_path)
remove_resume(const std::string &api_path) -> bool override; -> bool override;
[[nodiscard]] auto [[nodiscard]] auto remove_upload(const std::string &api_path)
remove_upload(const std::string &api_path) -> bool override; -> bool override;
[[nodiscard]] auto [[nodiscard]] auto remove_upload_active(const std::string &api_path)
remove_upload_active(const std::string &api_path) -> bool override; -> bool override;
[[nodiscard]] auto [[nodiscard]] auto rename_resume(const std::string &from_api_path,
rename_resume(const std::string &from_api_path, const std::string &to_api_path)
const std::string &to_api_path) -> bool override; -> bool override;
}; };
} // namespace repertory } // namespace repertory
#endif // REPERTORY_INCLUDE_DB_SQLITE_FILE_MGR_DB_HPP_ #endif // REPERTORY_INCLUDE_DB_IMPL_SQLITE_FILE_MGR_DB_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef REPERTORY_INCLUDE_DB_SQLITE_META_DB_HPP_ #ifndef REPERTORY_INCLUDE_DB_IMPL_SQLITE_META_DB_HPP_
#define REPERTORY_INCLUDE_DB_SQLITE_META_DB_HPP_ #define REPERTORY_INCLUDE_DB_IMPL_SQLITE_META_DB_HPP_
#include "db/i_meta_db.hpp" #include "db/i_meta_db.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -94,4 +94,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // REPERTORY_INCLUDE_DB_SQLITE_META_DB_HPP_ #endif // REPERTORY_INCLUDE_DB_IMPL_SQLITE_META_DB_HPP_

View File

@ -23,8 +23,8 @@
#include "app_config.hpp" #include "app_config.hpp"
#include "db/i_file_mgr_db.hpp" #include "db/i_file_mgr_db.hpp"
#include "db/rdb_file_mgr_db.hpp" #include "db/impl/rdb_file_mgr_db.hpp"
#include "db/sqlite_file_mgr_db.hpp" #include "db/impl/sqlite_file_mgr_db.hpp"
namespace repertory { namespace repertory {
auto create_file_mgr_db(const app_config &cfg) auto create_file_mgr_db(const app_config &cfg)

View File

@ -19,7 +19,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include "db/rdb_file_mgr_db.hpp" #include "db/impl/rdb_file_mgr_db.hpp"
#include "app_config.hpp" #include "app_config.hpp"
#include "types/startup_exception.hpp" #include "types/startup_exception.hpp"

View File

@ -19,7 +19,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include "db/rdb_meta_db.hpp" #include "db/impl/rdb_meta_db.hpp"
#include "app_config.hpp" #include "app_config.hpp"
#include "types/startup_exception.hpp" #include "types/startup_exception.hpp"

View File

@ -19,7 +19,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include "db/sqlite_file_mgr_db.hpp" #include "db/impl/sqlite_file_mgr_db.hpp"
#include "app_config.hpp" #include "app_config.hpp"
#include "utils/config.hpp" #include "utils/config.hpp"

View File

@ -19,7 +19,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include "db/sqlite_meta_db.hpp" #include "db/impl/sqlite_meta_db.hpp"
#include "app_config.hpp" #include "app_config.hpp"
#include "utils/db/sqlite/db_common.hpp" #include "utils/db/sqlite/db_common.hpp"

View File

@ -22,8 +22,8 @@
#include "db/meta_db.hpp" #include "db/meta_db.hpp"
#include "app_config.hpp" #include "app_config.hpp"
#include "db/rdb_meta_db.hpp" #include "db/impl/rdb_meta_db.hpp"
#include "db/sqlite_meta_db.hpp" #include "db/impl/sqlite_meta_db.hpp"
namespace repertory { namespace repertory {
auto create_meta_db(const app_config &cfg) -> std::unique_ptr<i_meta_db> { auto create_meta_db(const app_config &cfg) -> std::unique_ptr<i_meta_db> {

View File

@ -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); auto removed = mgr_db_->remove_upload_active(api_path);
if (not removed) { if (not removed) {
utils::error::raise_api_path_error( utils::error::raise_api_path_error(function_name, api_path,
function_name, api_path, api_error::error, api_error::error,
"failed to remove from upload_active table"); "failed to remove active upload");
} }
if (upload_lookup_.find(api_path) != upload_lookup_.end()) { if (upload_lookup_.find(api_path) != upload_lookup_.end()) {