Skip to content

Commit

Permalink
rgw/sfs: Wire sqlite_modern_cpp into sfs builds
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Lauhoff <[email protected]>
  • Loading branch information
Marcel Lauhoff committed Oct 25, 2023
1 parent e523152 commit 99e0a16
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/rgw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ endif()

if(WITH_RADOSGW_SFS)
target_include_directories(rgw_common PUBLIC "${CMAKE_SOURCE_DIR}/src/rgw/store/sfs")
target_include_directories(rgw_common PUBLIC "${CMAKE_SOURCE_DIR}/src/rgw/store/sfs/sqlite/sqlite_modern_cpp/hdr")
target_link_libraries(rgw_common PRIVATE global sfs)
endif()

Expand Down
9 changes: 9 additions & 0 deletions src/rgw/driver/sfs/sqlite/dbapi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include <sqlite3.h>

namespace rgw::sal::sfs::dbapi {

#include "sqlite_modern_cpp/hdr/sqlite_modern_cpp.h"

} // namespace rgw::sal::sfs::dbapi
6 changes: 6 additions & 0 deletions src/rgw/driver/sfs/sqlite/dbconn.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "buckets/multipart_definitions.h"
#include "common/ceph_mutex.h"
#include "common/dout.h"
#include "dbapi.h"
#include "lifecycle/lifecycle_definitions.h"
#include "objects/object_definitions.h"
#include "rgw/rgw_perf_counters.h"
Expand Down Expand Up @@ -272,6 +273,11 @@ class DBConn {

inline auto get_storage() const { return storage; }

// TODO make this return a pointer to the connection pool
dbapi::sqlite::database get() const {
return dbapi::sqlite::database(get_storage().filename());
}

static std::string getDBPath(CephContext* cct) {
auto rgw_sfs_path = cct->_conf.get_val<std::string>("rgw_sfs_data_path");
auto db_path =
Expand Down
1 change: 1 addition & 0 deletions src/test/rgw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ endif()

if(WITH_RADOSGW_SFS)
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/rgw/driver/sfs/sqlite/sqlite_orm/include")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/rgw/driver/sfs/sqlite/sqlite_modern_cpp/hdr")
endif()

if(WITH_JAEGER)
Expand Down

0 comments on commit 99e0a16

Please sign in to comment.