#include <stdio.h>
#include <iostream>
#include <mutex>
+#include <filesystem>
#include <condition_variable>
#include "fmt/format.h"
#include <map>
class DB {
private:
const std::string db_name;
+ const std::string table_name_prefix;
rgw::sal::Driver* driver;
const std::string account_table;
const std::string user_table;
public:
DB(std::string db_name, CephContext *_cct) : db_name(db_name),
- account_table(db_name+"_account_table"),
- user_table(db_name+"_user_table"),
- bucket_table(db_name+"_bucket_table"),
- quota_table(db_name+"_quota_table"),
- lc_head_table(db_name+"_lc_head_table"),
- lc_entry_table(db_name+"_lc_entry_table"),
+ table_name_prefix(std::filesystem::path(db_name).filename()),
+ account_table(table_name_prefix + "_account_table"),
+ user_table(table_name_prefix + "_user_table"),
+ bucket_table(table_name_prefix + "_bucket_table"),
+ quota_table(table_name_prefix + "_quota_table"),
+ lc_head_table(table_name_prefix + "_lc_head_table"),
+ lc_entry_table(table_name_prefix + "_lc_entry_table"),
cct(_cct),
dp(_cct, ceph_subsys_rgw, "rgw DBStore backend: ")
{}
/* DB() {}*/
DB(CephContext *_cct) : db_name("default_db"),
+
+ table_name_prefix(db_name),
account_table(db_name+"_account_table"),
user_table(db_name+"_user_table"),
bucket_table(db_name+"_bucket_table"),
const std::string getLCHeadTable() { return lc_head_table; }
const std::string getLCEntryTable() { return lc_entry_table; }
const std::string getObjectTable(std::string bucket) {
- return db_name+"_"+bucket+"_object_table"; }
+ return table_name_prefix+"_"+bucket+"_object_table"; }
const std::string getObjectDataTable(std::string bucket) {
- return db_name+"_"+bucket+"_objectdata_table"; }
+ return table_name_prefix+"_"+bucket+"_objectdata_table"; }
const std::string getObjectView(std::string bucket) {
- return db_name+"_"+bucket+"_object_view"; }
+ return table_name_prefix+"_"+bucket+"_object_view"; }
const std::string getObjectTrigger(std::string bucket) {
- return db_name+"_"+bucket+"_object_trigger"; }
+ return table_name_prefix+"_"+bucket+"_object_trigger"; }
std::map<std::string, class ObjectOp*> getObjectMap();
params.account_table = getAccountTable();
params.user_table = getUserTable();
params.bucket_table = getBucketTable();
+ params.quota_table = getQuotaTable();
if ((ca = createAccountTable(dpp, ¶ms)))
goto out;
DeleteUserTable(dpp, ¶ms);
if (cb)
DeleteBucketTable(dpp, ¶ms);
+ if (cq)
+ DeleteQuotaTable(dpp, ¶ms);
ldpp_dout(dpp, 0)<<"Creation of tables failed" << dendl;
}
DBOpParams params = {};
RGWAccessKey key("0555b35654ad1656d804", "h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q==");
- params.user_table = user_table;
- params.bucket_table = bucket_table;
- params.quota_table = quota_table;
- params.lc_entry_table = lc_entry_table;
- params.lc_head_table = lc_head_table;
+ params.user_table = getUserTable();
+ params.bucket_table = getBucketTable();
+ params.quota_table = getQuotaTable();
+ params.lc_entry_table = getLCEntryTable();
+ params.lc_head_table = getLCHeadTable();
+
params.op.user.uinfo.display_name = "tester";
params.op.user.uinfo.user_id.id = "test";
params.op.user.uinfo.access_keys["default"] = key;
class POSIXUserDB : public SQLiteDB {
private:
const std::string db_name;
- const std::string user_table;
- const std::string bucket_table;
- const std::string quota_table;
- const std::string lc_head_table;
- const std::string lc_entry_table;
-
rgw::sal::Driver* driver;
protected:
POSIXUserDB(std::string db_name, CephContext *_cct) : SQLiteDB(db_name, _cct),
db_name(db_name),
- user_table(db_name+"_user_table"),
cct(_cct),
dp(_cct, ceph_subsys_rgw, "rgw POSIXUserDBStore backend: ")
{ DB::set_context(cct); }