mirror of
https://github.com/ceph/ceph
synced 2025-01-04 02:02:36 +00:00
Merge pull request #44736 from adamemerson/wip-no-using-namespace-std
src: Remove some 'using namespace std' lines that crept back into headers Reviewed-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
commit
67ee1fba6c
@ -21,6 +21,7 @@
|
||||
#include "crimson/net/Socket.h"
|
||||
|
||||
using namespace crimson::common;
|
||||
using namespace std::literals;
|
||||
|
||||
namespace {
|
||||
seastar::logger& logger()
|
||||
|
@ -22,8 +22,6 @@
|
||||
#include "include/buffer.h"
|
||||
#include "crimson/net/Fwd.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
class MCommand;
|
||||
|
||||
namespace crimson::admin {
|
||||
|
@ -24,6 +24,7 @@ seastar::logger& logger()
|
||||
}
|
||||
} // namespace
|
||||
|
||||
using namespace std::literals;
|
||||
using std::string_view;
|
||||
using std::unique_ptr;
|
||||
using crimson::osd::OSD;
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "osd.h"
|
||||
|
||||
using namespace std::literals;
|
||||
namespace bpo = boost::program_options;
|
||||
using config_t = crimson::common::ConfigProxy;
|
||||
using std::string;
|
||||
|
@ -60,8 +60,6 @@
|
||||
#include "common/ceph_time.h"
|
||||
|
||||
namespace neorados {
|
||||
using namespace std::literals;
|
||||
|
||||
class Object;
|
||||
class IOContext;
|
||||
}
|
||||
@ -186,7 +184,7 @@ private:
|
||||
std::aligned_storage_t<impl_size> impl;
|
||||
};
|
||||
|
||||
inline constexpr std::string_view all_nspaces("\001"sv);
|
||||
inline constexpr std::string_view all_nspaces("\001");
|
||||
|
||||
enum class cmpxattr_op : std::uint8_t {
|
||||
eq = 1,
|
||||
|
@ -56,14 +56,14 @@ class ActivePyModules
|
||||
Objecter &objecter;
|
||||
Client &client;
|
||||
Finisher &finisher;
|
||||
TTLCache<string, PyObject*> ttl_cache;
|
||||
TTLCache<std::string, PyObject*> ttl_cache;
|
||||
public:
|
||||
Finisher cmd_finisher;
|
||||
private:
|
||||
DaemonServer &server;
|
||||
PyModuleRegistry &py_module_registry;
|
||||
|
||||
map<std::string,ProgressEvent> progress_events;
|
||||
std::map<std::string,ProgressEvent> progress_events;
|
||||
|
||||
mutable ceph::mutex lock = ceph::make_mutex("ActivePyModules::lock");
|
||||
|
||||
|
@ -10,8 +10,6 @@
|
||||
|
||||
#include "PyUtil.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <class Key, class Value> class Cache {
|
||||
private:
|
||||
std::atomic<uint64_t> hits, misses;
|
||||
@ -20,7 +18,7 @@ template <class Key, class Value> class Cache {
|
||||
unsigned int capacity;
|
||||
Cache(unsigned int size = UINT16_MAX) : hits{0}, misses{0}, capacity{size} {};
|
||||
std::map<Key, Value> content;
|
||||
std::vector<string> allowed_keys = {"osd_map", "pg_dump", "pg_stats"};
|
||||
std::vector<std::string> allowed_keys = {"osd_map", "pg_dump", "pg_stats"};
|
||||
|
||||
void mark_miss() {
|
||||
misses++;
|
||||
|
@ -37,6 +37,8 @@
|
||||
#include "neorados/RADOSImpl.h"
|
||||
#include "include/neorados/RADOS.hpp"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
namespace bc = boost::container;
|
||||
namespace bs = boost::system;
|
||||
namespace ca = ceph::async;
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include "scrub_machine_lstnr.h"
|
||||
#include "osd/scrubber_common.h"
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
class PG; // holding a pointer to that one - just for testing
|
||||
class PgScrubber;
|
||||
namespace Scrub {
|
||||
|
@ -55,7 +55,7 @@ int main(const int argc, const char **argv)
|
||||
{
|
||||
auto args = argv_to_vec(argc, argv);
|
||||
if (args.empty()) {
|
||||
cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||
std::cerr << argv[0] << ": -h or --help for usage" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
if (ceph_argparse_need_usage(args)) {
|
||||
|
@ -32,8 +32,6 @@
|
||||
#include "rgw_sal.h"
|
||||
#include "rgw_sal_rados.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class RGWSI_RADOS;
|
||||
class RGWSI_Zone;
|
||||
class RGWBucketInfo;
|
||||
@ -50,27 +48,27 @@ public:
|
||||
|
||||
int objexp_hint_add(const DoutPrefixProvider *dpp,
|
||||
const ceph::real_time& delete_at,
|
||||
const string& tenant_name,
|
||||
const string& bucket_name,
|
||||
const string& bucket_id,
|
||||
const std::string& tenant_name,
|
||||
const std::string& bucket_name,
|
||||
const std::string& bucket_id,
|
||||
const rgw_obj_index_key& obj_key);
|
||||
|
||||
int objexp_hint_list(const DoutPrefixProvider *dpp,
|
||||
const string& oid,
|
||||
const std::string& oid,
|
||||
const ceph::real_time& start_time,
|
||||
const ceph::real_time& end_time,
|
||||
const int max_entries,
|
||||
const string& marker,
|
||||
list<cls_timeindex_entry>& entries, /* out */
|
||||
string *out_marker, /* out */
|
||||
const std::string& marker,
|
||||
std::list<cls_timeindex_entry>& entries, /* out */
|
||||
std::string *out_marker, /* out */
|
||||
bool *truncated); /* out */
|
||||
|
||||
int objexp_hint_trim(const DoutPrefixProvider *dpp,
|
||||
const string& oid,
|
||||
const std::string& oid,
|
||||
const ceph::real_time& start_time,
|
||||
const ceph::real_time& end_time,
|
||||
const string& from_marker,
|
||||
const string& to_marker);
|
||||
const std::string& from_marker,
|
||||
const std::string& to_marker);
|
||||
};
|
||||
|
||||
class RGWObjectExpirer {
|
||||
@ -95,8 +93,8 @@ protected:
|
||||
void stop();
|
||||
|
||||
CephContext *get_cct() const override;
|
||||
unsigned get_subsys() const;
|
||||
std::ostream& gen_prefix(std::ostream& out) const;
|
||||
unsigned get_subsys() const override;
|
||||
std::ostream& gen_prefix(std::ostream& out) const override;
|
||||
};
|
||||
|
||||
OEWorker *worker{nullptr};
|
||||
@ -114,9 +112,9 @@ public:
|
||||
|
||||
int hint_add(const DoutPrefixProvider *dpp,
|
||||
const ceph::real_time& delete_at,
|
||||
const string& tenant_name,
|
||||
const string& bucket_name,
|
||||
const string& bucket_id,
|
||||
const std::string& tenant_name,
|
||||
const std::string& bucket_name,
|
||||
const std::string& bucket_id,
|
||||
const rgw_obj_index_key& obj_key) {
|
||||
return exp_store.objexp_hint_add(dpp, delete_at, tenant_name, bucket_name,
|
||||
bucket_id, obj_key);
|
||||
@ -132,8 +130,8 @@ public:
|
||||
const std::string& shard,
|
||||
const utime_t& from,
|
||||
const utime_t& to,
|
||||
const string& from_marker,
|
||||
const string& to_marker);
|
||||
const std::string& from_marker,
|
||||
const std::string& to_marker);
|
||||
|
||||
bool process_single_shard(const DoutPrefixProvider *dpp,
|
||||
const std::string& shard,
|
||||
|
@ -52,8 +52,6 @@
|
||||
|
||||
#include "common/Clock.h"
|
||||
|
||||
using namespace librados;
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
@ -101,6 +99,8 @@ using namespace librados;
|
||||
#define dout_context g_ceph_context
|
||||
#define dout_subsys ceph_subsys_rgw
|
||||
|
||||
using namespace std;
|
||||
using namespace librados;
|
||||
|
||||
static string shadow_ns = "shadow";
|
||||
static string default_bucket_index_pool_suffix = "rgw.buckets.index";
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#define dout_subsys ceph_subsys_rgw
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace rgw::sal {
|
||||
|
||||
int DBUser::list_buckets(const DoutPrefixProvider *dpp, const string& marker,
|
||||
|
@ -110,7 +110,7 @@ protected:
|
||||
virtual int complete_flush_stats(const DoutPrefixProvider *dpp, optional_yield y) override;
|
||||
virtual int read_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries,
|
||||
bool* is_truncated, RGWUsageIter& usage_iter,
|
||||
map<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
|
||||
std::map<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
|
||||
virtual int trim_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch) override;
|
||||
|
||||
/* Placeholders */
|
||||
@ -205,7 +205,7 @@ protected:
|
||||
virtual int try_refresh_info(const DoutPrefixProvider *dpp, ceph::real_time *pmtime) override;
|
||||
virtual int read_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries,
|
||||
bool *is_truncated, RGWUsageIter& usage_iter,
|
||||
map<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
|
||||
std::map<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
|
||||
virtual int trim_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch) override;
|
||||
virtual int remove_objs_from_index(const DoutPrefixProvider *dpp, std::list<rgw_obj_index_key>& objs_to_unlink) override;
|
||||
virtual int check_index(const DoutPrefixProvider *dpp, std::map<RGWObjCategory, RGWStorageStats>& existing_stats, std::map<RGWObjCategory, RGWStorageStats>& calculated_stats) override;
|
||||
@ -219,12 +219,12 @@ protected:
|
||||
const std::string& oid, std::optional<std::string> upload_id,
|
||||
ACLOwner owner={}, ceph::real_time mtime=ceph::real_clock::now()) override;
|
||||
virtual int list_multiparts(const DoutPrefixProvider *dpp,
|
||||
const string& prefix,
|
||||
string& marker,
|
||||
const string& delim,
|
||||
const std::string& prefix,
|
||||
std::string& marker,
|
||||
const std::string& delim,
|
||||
const int& max_uploads,
|
||||
vector<std::unique_ptr<MultipartUpload>>& uploads,
|
||||
map<string, bool> *common_prefixes,
|
||||
std::vector<std::unique_ptr<MultipartUpload>>& uploads,
|
||||
std::map<std::string, bool> *common_prefixes,
|
||||
bool *is_truncated) override;
|
||||
virtual int abort_multiparts(const DoutPrefixProvider* dpp,
|
||||
CephContext* cct) override;
|
||||
@ -620,13 +620,13 @@ protected:
|
||||
const rgw_placement_rule *ptail_placement_rule;
|
||||
uint64_t olh_epoch;
|
||||
std::unique_ptr<rgw::sal::Object> head_obj;
|
||||
string upload_id;
|
||||
string oid; /* object->name() + "." + "upload_id" + "." + part_num */
|
||||
std::string upload_id;
|
||||
std::string oid; /* object->name() + "." + "upload_id" + "." + part_num */
|
||||
std::unique_ptr<rgw::sal::Object> meta_obj;
|
||||
DB::Object op_target;
|
||||
DB::Object::Write parent_op;
|
||||
int part_num;
|
||||
string part_num_str;
|
||||
std::string part_num_str;
|
||||
uint64_t total_data_size = 0; /* for total data being uploaded */
|
||||
bufferlist head_data;
|
||||
bufferlist tail_part_data;
|
||||
@ -671,7 +671,7 @@ public:
|
||||
* multiple db handles (for eg., one for each tenant),
|
||||
* use dbsm->getDB(tenant) */
|
||||
DB *db;
|
||||
string luarocks_path;
|
||||
std::string luarocks_path;
|
||||
DBZone zone;
|
||||
RGWSyncModuleInstanceRef sync_module;
|
||||
RGWLC* lc;
|
||||
@ -728,13 +728,13 @@ public:
|
||||
|
||||
virtual RGWLC* get_rgwlc(void) override;
|
||||
virtual RGWCoroutinesManagerRegistry* get_cr_registry() override { return NULL; }
|
||||
virtual int log_usage(const DoutPrefixProvider *dpp, map<rgw_user_bucket, RGWUsageBatch>& usage_info) override;
|
||||
virtual int log_usage(const DoutPrefixProvider *dpp, std::map<rgw_user_bucket, RGWUsageBatch>& usage_info) override;
|
||||
virtual int log_op(const DoutPrefixProvider *dpp, std::string& oid, bufferlist& bl) override;
|
||||
virtual int register_to_service_map(const DoutPrefixProvider *dpp, const string& daemon_type,
|
||||
const map<string, string>& meta) override;
|
||||
virtual int register_to_service_map(const DoutPrefixProvider *dpp, const std::string& daemon_type,
|
||||
const std::map<std::string, std::string>& meta) override;
|
||||
virtual void get_ratelimit(RGWRateLimitInfo& bucket_ratelimit, RGWRateLimitInfo& user_ratelimit, RGWRateLimitInfo& anon_ratelimit) override;
|
||||
virtual void get_quota(RGWQuotaInfo& bucket_quota, RGWQuotaInfo& user_quota) override;
|
||||
virtual int set_buckets_enabled(const DoutPrefixProvider *dpp, vector<rgw_bucket>& buckets, bool enabled) override;
|
||||
virtual int set_buckets_enabled(const DoutPrefixProvider *dpp, std::vector<rgw_bucket>& buckets, bool enabled) override;
|
||||
virtual uint64_t get_new_req_id() override { return 0; }
|
||||
virtual int get_sync_policy_handler(const DoutPrefixProvider *dpp,
|
||||
std::optional<rgw_zone_id> zone,
|
||||
@ -742,20 +742,20 @@ public:
|
||||
RGWBucketSyncPolicyHandlerRef *phandler,
|
||||
optional_yield y) override;
|
||||
virtual RGWDataSyncStatusManager* get_data_sync_manager(const rgw_zone_id& source_zone) override;
|
||||
virtual void wakeup_meta_sync_shards(set<int>& shard_ids) override { return; }
|
||||
virtual void wakeup_data_sync_shards(const DoutPrefixProvider *dpp, const rgw_zone_id& source_zone, map<int, set<string> >& shard_ids) override { return; }
|
||||
virtual void wakeup_meta_sync_shards(std::set<int>& shard_ids) override { return; }
|
||||
virtual void wakeup_data_sync_shards(const DoutPrefixProvider *dpp, const rgw_zone_id& source_zone, std::map<int, std::set<std::string>>& shard_ids) override { return; }
|
||||
virtual int clear_usage(const DoutPrefixProvider *dpp) override { return 0; }
|
||||
virtual int read_all_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch,
|
||||
uint32_t max_entries, bool *is_truncated,
|
||||
RGWUsageIter& usage_iter,
|
||||
map<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
|
||||
std::map<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
|
||||
virtual int trim_all_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch) override;
|
||||
virtual int get_config_key_val(std::string name, bufferlist* bl) override;
|
||||
virtual int meta_list_keys_init(const DoutPrefixProvider *dpp, const std::string& section, const std::string& marker, void** phandle) override;
|
||||
virtual int meta_list_keys_next(const DoutPrefixProvider *dpp, void* handle, int max, list<std::string>& keys, bool* truncated) override;
|
||||
virtual int meta_list_keys_next(const DoutPrefixProvider *dpp, void* handle, int max, std::list<std::string>& keys, bool* truncated) override;
|
||||
virtual void meta_list_keys_complete(void* handle) override;
|
||||
virtual std::string meta_get_marker(void *handle) override;
|
||||
virtual int meta_remove(const DoutPrefixProvider *dpp, string& metadata_key, optional_yield y) override;
|
||||
virtual int meta_remove(const DoutPrefixProvider *dpp, std::string& metadata_key, optional_yield y) override;
|
||||
|
||||
virtual const RGWSyncModuleInstanceRef& get_sync_module() { return sync_module; }
|
||||
virtual std::string get_host_id() { return ""; }
|
||||
@ -772,11 +772,11 @@ public:
|
||||
optional_yield y,
|
||||
const std::string& path_prefix,
|
||||
const std::string& tenant,
|
||||
vector<std::unique_ptr<RGWRole>>& roles) override;
|
||||
std::vector<std::unique_ptr<RGWRole>>& roles) override;
|
||||
virtual std::unique_ptr<RGWOIDCProvider> get_oidc_provider() override;
|
||||
virtual int get_oidc_providers(const DoutPrefixProvider *dpp,
|
||||
const std::string& tenant,
|
||||
vector<std::unique_ptr<RGWOIDCProvider>>& providers) override;
|
||||
std::vector<std::unique_ptr<RGWOIDCProvider>>& providers) override;
|
||||
virtual std::unique_ptr<Writer> get_append_writer(const DoutPrefixProvider *dpp,
|
||||
optional_yield y,
|
||||
std::unique_ptr<rgw::sal::Object> _head_obj,
|
||||
@ -814,7 +814,7 @@ public:
|
||||
void setDB(DB * st) { db = st; }
|
||||
DB *getDB(void) { return db; }
|
||||
|
||||
DB *getDB(string tenant) { return dbsm->getDB(tenant, false); }
|
||||
DB *getDB(std::string tenant) { return dbsm->getDB(tenant, false); }
|
||||
};
|
||||
|
||||
} } // namespace rgw::sal
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,15 +4,13 @@
|
||||
#ifndef DB_STORE_LOG_H
|
||||
#define DB_STORE_LOG_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "common/dout.h"
|
||||
|
||||
using namespace std;
|
||||
#include "common/dout.h"
|
||||
|
||||
#define dout_subsys ceph_subsys_rgw
|
||||
#undef dout_prefix
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <dbstore.h>
|
||||
#include <dbstore_log.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace rgw::store;
|
||||
using DB = rgw::store::DB;
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "dbstore_mgr.h"
|
||||
#include "common/dbstore_log.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/* Given a tenant, find and return the DBStore handle.
|
||||
* If not found and 'create' set to true, create one
|
||||
* and return
|
||||
|
@ -4,27 +4,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "common/ceph_context.h"
|
||||
#include "common/dbstore.h"
|
||||
#include "sqlite/sqliteDB.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace rgw::store;
|
||||
using DB = rgw::store::DB;
|
||||
|
||||
/* XXX: Should be a dbstore config option */
|
||||
const static string default_tenant = "default_ns";
|
||||
|
||||
using namespace std;
|
||||
const static std::string default_tenant = "default_ns";
|
||||
|
||||
class DBStoreManager {
|
||||
private:
|
||||
map<string, DB*> DBStoreHandles;
|
||||
std::map<std::string, DB*> DBStoreHandles;
|
||||
DB *default_db = NULL;
|
||||
CephContext *cct;
|
||||
|
||||
@ -33,9 +32,9 @@ public:
|
||||
cct = _cct;
|
||||
default_db = createDB(default_tenant);
|
||||
};
|
||||
DBStoreManager(string logfile, int loglevel): DBStoreHandles() {
|
||||
DBStoreManager(std::string logfile, int loglevel): DBStoreHandles() {
|
||||
/* No ceph context. Create one with log args provided */
|
||||
vector<const char*> args;
|
||||
std::vector<const char*> args;
|
||||
cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
|
||||
CODE_ENVIRONMENT_DAEMON, CINIT_FLAG_NO_MON_CONFIG, 1)->get();
|
||||
cct->_log->set_log_file(logfile);
|
||||
@ -50,9 +49,9 @@ public:
|
||||
* being deleted while using it.
|
||||
*/
|
||||
DB* getDB () { return default_db; };
|
||||
DB* getDB (string tenant, bool create);
|
||||
DB* createDB (string tenant);
|
||||
void deleteDB (string tenant);
|
||||
DB* getDB (std::string tenant, bool create);
|
||||
DB* createDB (std::string tenant);
|
||||
void deleteDB (std::string tenant);
|
||||
void deleteDB (DB* db);
|
||||
void destroyAllHandles();
|
||||
};
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include "sqliteDB.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define SQL_PREPARE(dpp, params, sdb, stmt, ret, Op) \
|
||||
do { \
|
||||
string schema; \
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <sqlite3.h>
|
||||
#include "rgw/store/dbstore/common/dbstore.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace rgw::store;
|
||||
|
||||
class SQLiteDB : public DB, virtual public DBOp {
|
||||
@ -20,15 +19,15 @@ class SQLiteDB : public DB, virtual public DBOp {
|
||||
protected:
|
||||
CephContext *cct;
|
||||
|
||||
public:
|
||||
public:
|
||||
sqlite3_stmt *stmt = NULL;
|
||||
DBOpPrepareParams PrepareParams;
|
||||
|
||||
SQLiteDB(sqlite3 *dbi, string db_name, CephContext *_cct) : DB(db_name, _cct), cct(_cct) {
|
||||
SQLiteDB(sqlite3 *dbi, std::string db_name, CephContext *_cct) : DB(db_name, _cct), cct(_cct) {
|
||||
db = (void*)dbi;
|
||||
InitPrepareParams(get_def_dpp(), PrepareParams);
|
||||
}
|
||||
SQLiteDB(string db_name, CephContext *_cct) : DB(db_name, _cct), cct(_cct) {
|
||||
SQLiteDB(std::string db_name, CephContext *_cct) : DB(db_name, _cct), cct(_cct) {
|
||||
InitPrepareParams(get_def_dpp(), PrepareParams);
|
||||
}
|
||||
~SQLiteDB() {}
|
||||
@ -48,7 +47,7 @@ class SQLiteDB : public DB, virtual public DBOp {
|
||||
int Reset(const DoutPrefixProvider *dpp, sqlite3_stmt *stmt);
|
||||
/* default value matches with sqliteDB style */
|
||||
|
||||
int createTables(const DoutPrefixProvider *dpp);
|
||||
int createTables(const DoutPrefixProvider *dpp) override;
|
||||
int createBucketTable(const DoutPrefixProvider *dpp, DBOpParams *params);
|
||||
int createUserTable(const DoutPrefixProvider *dpp, DBOpParams *params);
|
||||
int createObjectTable(const DoutPrefixProvider *dpp, DBOpParams *params);
|
||||
@ -79,7 +78,7 @@ class SQLObjectOp : public ObjectOp {
|
||||
SQLObjectOp(sqlite3 **sdbi, CephContext *_cct) : sdb(sdbi), cct(_cct) {};
|
||||
~SQLObjectOp() {}
|
||||
|
||||
int InitializeObjectOps(string db_name, const DoutPrefixProvider *dpp);
|
||||
int InitializeObjectOps(std::string db_name, const DoutPrefixProvider *dpp);
|
||||
int FreeObjectOps(const DoutPrefixProvider *dpp);
|
||||
};
|
||||
|
||||
@ -89,7 +88,7 @@ class SQLInsertUser : public SQLiteDB, public InsertUserOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLInsertUser(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLInsertUser(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLInsertUser() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -105,7 +104,7 @@ class SQLRemoveUser : public SQLiteDB, public RemoveUserOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLRemoveUser(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLRemoveUser(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLRemoveUser() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -124,7 +123,7 @@ class SQLGetUser : public SQLiteDB, public GetUserOp {
|
||||
sqlite3_stmt *userid_stmt = NULL; // Prepared statement to query by user_id
|
||||
|
||||
public:
|
||||
SQLGetUser(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLGetUser(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLGetUser() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -146,7 +145,7 @@ class SQLInsertBucket : public SQLiteDB, public InsertBucketOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLInsertBucket(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLInsertBucket(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLInsertBucket() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -164,7 +163,7 @@ class SQLUpdateBucket : public SQLiteDB, public UpdateBucketOp {
|
||||
sqlite3_stmt *owner_stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLUpdateBucket(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLUpdateBucket(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLUpdateBucket() {
|
||||
if (info_stmt)
|
||||
sqlite3_finalize(info_stmt);
|
||||
@ -184,7 +183,7 @@ class SQLRemoveBucket : public SQLiteDB, public RemoveBucketOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLRemoveBucket(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLRemoveBucket(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLRemoveBucket() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -200,7 +199,7 @@ class SQLGetBucket : public SQLiteDB, public GetBucketOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLGetBucket(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLGetBucket(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLGetBucket() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -216,7 +215,7 @@ class SQLListUserBuckets : public SQLiteDB, public ListUserBucketsOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLListUserBuckets(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLListUserBuckets(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLListUserBuckets() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -232,8 +231,8 @@ class SQLPutObject : public SQLiteDB, public PutObjectOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLPutObject(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLPutObject(sqlite3 **sdbi, string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
SQLPutObject(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLPutObject(sqlite3 **sdbi, std::string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
|
||||
~SQLPutObject() {
|
||||
if (stmt)
|
||||
@ -250,8 +249,8 @@ class SQLDeleteObject : public SQLiteDB, public DeleteObjectOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLDeleteObject(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLDeleteObject(sqlite3 **sdbi, string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
SQLDeleteObject(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLDeleteObject(sqlite3 **sdbi, std::string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
|
||||
~SQLDeleteObject() {
|
||||
if (stmt)
|
||||
@ -268,8 +267,8 @@ class SQLGetObject : public SQLiteDB, public GetObjectOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLGetObject(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLGetObject(sqlite3 **sdbi, string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
SQLGetObject(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLGetObject(sqlite3 **sdbi, std::string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
|
||||
~SQLGetObject() {
|
||||
if (stmt)
|
||||
@ -289,8 +288,8 @@ class SQLUpdateObject : public SQLiteDB, public UpdateObjectOp {
|
||||
sqlite3_stmt *mp_stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLUpdateObject(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLUpdateObject(sqlite3 **sdbi, string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
SQLUpdateObject(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLUpdateObject(sqlite3 **sdbi, std::string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
|
||||
~SQLUpdateObject() {
|
||||
if (omap_stmt)
|
||||
@ -312,8 +311,8 @@ class SQLListBucketObjects : public SQLiteDB, public ListBucketObjectsOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLListBucketObjects(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLListBucketObjects(sqlite3 **sdbi, string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
SQLListBucketObjects(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLListBucketObjects(sqlite3 **sdbi, std::string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
|
||||
~SQLListBucketObjects() {
|
||||
if (stmt)
|
||||
@ -330,8 +329,8 @@ class SQLPutObjectData : public SQLiteDB, public PutObjectDataOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLPutObjectData(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLPutObjectData(sqlite3 **sdbi, string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
SQLPutObjectData(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLPutObjectData(sqlite3 **sdbi, std::string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
|
||||
~SQLPutObjectData() {
|
||||
if (stmt)
|
||||
@ -348,8 +347,8 @@ class SQLUpdateObjectData : public SQLiteDB, public UpdateObjectDataOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLUpdateObjectData(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLUpdateObjectData(sqlite3 **sdbi, string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
SQLUpdateObjectData(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLUpdateObjectData(sqlite3 **sdbi, std::string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
|
||||
~SQLUpdateObjectData() {
|
||||
if (stmt)
|
||||
@ -366,8 +365,8 @@ class SQLGetObjectData : public SQLiteDB, public GetObjectDataOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLGetObjectData(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLGetObjectData(sqlite3 **sdbi, string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
SQLGetObjectData(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLGetObjectData(sqlite3 **sdbi, std::string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
|
||||
~SQLGetObjectData() {
|
||||
if (stmt)
|
||||
@ -384,8 +383,8 @@ class SQLDeleteObjectData : public SQLiteDB, public DeleteObjectDataOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLDeleteObjectData(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLDeleteObjectData(sqlite3 **sdbi, string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
SQLDeleteObjectData(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLDeleteObjectData(sqlite3 **sdbi, std::string db_name, CephContext *cct) : SQLiteDB(*sdbi, db_name, cct), sdb(sdbi) {}
|
||||
|
||||
~SQLDeleteObjectData() {
|
||||
if (stmt)
|
||||
@ -402,7 +401,7 @@ class SQLInsertLCEntry : public SQLiteDB, public InsertLCEntryOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLInsertLCEntry(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLInsertLCEntry(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLInsertLCEntry() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -418,7 +417,7 @@ class SQLRemoveLCEntry : public SQLiteDB, public RemoveLCEntryOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLRemoveLCEntry(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLRemoveLCEntry(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLRemoveLCEntry() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -435,7 +434,7 @@ class SQLGetLCEntry : public SQLiteDB, public GetLCEntryOp {
|
||||
sqlite3_stmt *next_stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLGetLCEntry(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLGetLCEntry(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLGetLCEntry() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -453,7 +452,7 @@ class SQLListLCEntries : public SQLiteDB, public ListLCEntriesOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLListLCEntries(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLListLCEntries(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLListLCEntries() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -469,7 +468,7 @@ class SQLInsertLCHead : public SQLiteDB, public InsertLCHeadOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLInsertLCHead(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLInsertLCHead(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLInsertLCHead() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -485,7 +484,7 @@ class SQLRemoveLCHead : public SQLiteDB, public RemoveLCHeadOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLRemoveLCHead(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLRemoveLCHead(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLRemoveLCHead() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
@ -501,7 +500,7 @@ class SQLGetLCHead : public SQLiteDB, public GetLCHeadOp {
|
||||
sqlite3_stmt *stmt = NULL; // Prepared statement
|
||||
|
||||
public:
|
||||
SQLGetLCHead(void **db, string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
SQLGetLCHead(void **db, std::string db_name, CephContext *cct) : SQLiteDB((sqlite3 *)(*db), db_name, cct), sdb((sqlite3 **)db) {}
|
||||
~SQLGetLCHead() {
|
||||
if (stmt)
|
||||
sqlite3_finalize(stmt);
|
||||
|
@ -35,15 +35,13 @@
|
||||
|
||||
#define MINIMUM_TO_RECOVER 2u
|
||||
|
||||
using namespace std;
|
||||
|
||||
class ErasureCodeExample final : public ErasureCode {
|
||||
public:
|
||||
~ErasureCodeExample() override {}
|
||||
|
||||
int create_rule(const std::string &name,
|
||||
CrushWrapper &crush,
|
||||
ostream *ss) const override {
|
||||
std::ostream *ss) const override {
|
||||
return crush.add_simple_rule(name, "default", "host", "",
|
||||
"indep", pg_pool_t::TYPE_ERASURE, ss);
|
||||
}
|
||||
@ -70,7 +68,7 @@ public:
|
||||
c2c[CODING_CHUNK] > c2c[SECOND_DATA_CHUNK])
|
||||
c2c.erase(CODING_CHUNK);
|
||||
}
|
||||
set <int> available_chunks;
|
||||
std::set <int> available_chunks;
|
||||
for (std::map<int, int>::const_iterator i = c2c.begin();
|
||||
i != c2c.end();
|
||||
++i)
|
||||
@ -116,7 +114,7 @@ public:
|
||||
// to chunk boundaries
|
||||
//
|
||||
const bufferptr &ptr = out.front();
|
||||
for (set<int>::iterator j = want_to_encode.begin();
|
||||
for (auto j = want_to_encode.begin();
|
||||
j != want_to_encode.end();
|
||||
++j) {
|
||||
bufferlist tmp;
|
||||
@ -136,7 +134,7 @@ public:
|
||||
|
||||
int _decode(const std::set<int> &want_to_read,
|
||||
const std::map<int, bufferlist> &chunks,
|
||||
std::map<int, bufferlist> *decoded) {
|
||||
std::map<int, bufferlist> *decoded) override {
|
||||
//
|
||||
// All chunks have the same size
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
||||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
||||
// vim: ts=8 sw=2 smarttab
|
||||
/*
|
||||
* Ceph distributed storage system
|
||||
@ -11,7 +11,7 @@
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -20,6 +20,8 @@
|
||||
#include "global/global_context.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
TEST(ErasureCodeExample, chunk_size)
|
||||
{
|
||||
ErasureCodeExample example;
|
||||
|
@ -35,6 +35,15 @@
|
||||
#include "erasure-code/ErasureCode.h"
|
||||
#include "ceph_erasure_code_benchmark.h"
|
||||
|
||||
using std::endl;
|
||||
using std::cerr;
|
||||
using std::cout;
|
||||
using std::map;
|
||||
using std::set;
|
||||
using std::string;
|
||||
using std::stringstream;
|
||||
using std::vector;
|
||||
|
||||
namespace po = boost::program_options;
|
||||
|
||||
int ErasureCodeBench::setup(int argc, char** argv) {
|
||||
@ -175,7 +184,7 @@ int ErasureCodeBench::encode()
|
||||
}
|
||||
utime_t begin_time = ceph_clock_now();
|
||||
for (int i = 0; i < max_iterations; i++) {
|
||||
map<int,bufferlist> encoded;
|
||||
std::map<int,bufferlist> encoded;
|
||||
code = erasure_code->encode(want_to_encode, in, &encoded);
|
||||
if (code)
|
||||
return code;
|
||||
|
@ -19,8 +19,16 @@
|
||||
#define CEPH_ERASURE_CODE_BENCHMARK_H
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
#include "include/buffer.h"
|
||||
|
||||
#include "common/ceph_context.h"
|
||||
|
||||
#include "erasure-code/ErasureCodeInterface.h"
|
||||
|
||||
class ErasureCodeBench {
|
||||
int in_size;
|
||||
@ -29,21 +37,21 @@ class ErasureCodeBench {
|
||||
int k;
|
||||
int m;
|
||||
|
||||
string plugin;
|
||||
std::string plugin;
|
||||
|
||||
bool exhaustive_erasures;
|
||||
vector<int> erased;
|
||||
string workload;
|
||||
std::vector<int> erased;
|
||||
std::string workload;
|
||||
|
||||
ErasureCodeProfile profile;
|
||||
ceph::ErasureCodeProfile profile;
|
||||
|
||||
bool verbose;
|
||||
boost::intrusive_ptr<CephContext> cct;
|
||||
public:
|
||||
int setup(int argc, char** argv);
|
||||
int run();
|
||||
int decode_erasures(const map<int,bufferlist> &all_chunks,
|
||||
const map<int,bufferlist> &chunks,
|
||||
int decode_erasures(const std::map<int, ceph::buffer::list> &all_chunks,
|
||||
const std::map<int, ceph::buffer::list> &chunks,
|
||||
unsigned i,
|
||||
unsigned want_erasures,
|
||||
ErasureCodeInterfaceRef erasure_code);
|
||||
|
@ -25,9 +25,6 @@
|
||||
#include <cfloat>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using ceph::bufferlist;
|
||||
|
||||
/**
|
||||
* stores pairings from op type to time taken for that op (for latency), and to
|
||||
* time that op completed to the nearest second (for throughput).
|
||||
@ -69,7 +66,7 @@ struct timed_args {
|
||||
StopWatch sw;
|
||||
//kv_bench_data data;
|
||||
KvStoreBench * kvsb;
|
||||
bufferlist val;
|
||||
ceph::buffer::list val;
|
||||
int err;
|
||||
char op;
|
||||
|
||||
@ -86,7 +83,7 @@ struct timed_args {
|
||||
{}
|
||||
};
|
||||
|
||||
typedef pair<string, bufferlist> (KvStoreBench::*next_gen_t)(bool new_elem);
|
||||
typedef std::pair<std::string, ceph::buffer::list> (KvStoreBench::*next_gen_t)(bool new_elem);
|
||||
|
||||
class KvStoreBench {
|
||||
|
||||
@ -107,13 +104,13 @@ protected:
|
||||
int cache_size; //number of index entries to store in cache
|
||||
double cache_refresh; //cache_size / cache_refresh entries are read each time
|
||||
//the index is read
|
||||
string client_name;
|
||||
std::string client_name;
|
||||
bool verbose;//if true, display debug output
|
||||
|
||||
//internal
|
||||
map<int, char> probs;//map of numbers from 1 to 100 to chars representing
|
||||
std::map<int, char> probs;//map of numbers from 1 to 100 to chars representing
|
||||
//operation types - used to generate random operations
|
||||
set<string> key_set;//set of keys already in the data set
|
||||
std::set<std::string> key_set;//set of keys already in the data set
|
||||
KeyValueStructure * kvs;
|
||||
kv_bench_data data;//stores throughput and latency from completed tests
|
||||
ceph::mutex data_lock = ceph::make_mutex("data lock");
|
||||
@ -123,8 +120,8 @@ protected:
|
||||
ceph::make_mutex("KvStoreBench::ops_in_flight_lock");
|
||||
//these are used for cleanup and setup purposes - they are NOT passed to kvs!
|
||||
librados::Rados rados;
|
||||
string rados_id;
|
||||
string pool_name;
|
||||
std::string rados_id;
|
||||
std::string pool_name;
|
||||
bool io_ctx_ready;
|
||||
librados::IoCtx io_ctx;
|
||||
|
||||
@ -153,7 +150,7 @@ public:
|
||||
/**
|
||||
* Returns a string of random characters of length len
|
||||
*/
|
||||
string random_string(int len);
|
||||
std::string random_string(int len);
|
||||
|
||||
/**
|
||||
* Inserts entries random keys and values asynchronously.
|
||||
@ -164,20 +161,20 @@ public:
|
||||
* calls test_random_insertions, then does ops randomly chosen operations
|
||||
* asynchronously, with max_ops_in_flight operations at a time.
|
||||
*/
|
||||
int test_teuthology_aio(next_gen_t distr, const map<int, char> &probs);
|
||||
int test_teuthology_aio(next_gen_t distr, const std::map<int, char> &probs);
|
||||
|
||||
/**
|
||||
* calls test_random_insertions, then does ops randomly chosen operations
|
||||
* synchronously.
|
||||
*/
|
||||
int test_teuthology_sync(next_gen_t distr, const map<int, char> &probs);
|
||||
int test_teuthology_sync(next_gen_t distr, const std::map<int, char> &probs);
|
||||
|
||||
/**
|
||||
* returns a key-value pair. If new_elem is true, the key is randomly
|
||||
* generated. If it is false, the key is selected from the keys currently in
|
||||
* the key set.
|
||||
*/
|
||||
pair<string, bufferlist> rand_distr(bool new_elem);
|
||||
std::pair<std::string, ceph::buffer::list> rand_distr(bool new_elem);
|
||||
|
||||
/**
|
||||
* Called when aio operations complete. Updates data.
|
||||
|
@ -22,12 +22,14 @@
|
||||
#include <boost/system/system_error.hpp>
|
||||
|
||||
namespace bs = boost::system;
|
||||
using namespace std::literals;
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace neorados {
|
||||
namespace detail {
|
||||
|
||||
struct Client {
|
||||
class Client {
|
||||
public:
|
||||
ceph::mutex mutex = ceph::make_mutex("NeoradosTestStub::Client");
|
||||
|
||||
librados::TestRadosClient* test_rados_client;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,10 +17,10 @@ void TestOpStat::end(TestOp *in) {
|
||||
stats[in->getType()].end(in);
|
||||
}
|
||||
|
||||
void TestOpStat::TypeStatus::export_latencies(map<double,uint64_t> &in) const
|
||||
void TestOpStat::TypeStatus::export_latencies(std::map<double,uint64_t> &in) const
|
||||
{
|
||||
map<double,uint64_t>::iterator i = in.begin();
|
||||
multiset<uint64_t>::iterator j = latencies.begin();
|
||||
auto i = in.begin();
|
||||
auto j = latencies.begin();
|
||||
int count = 0;
|
||||
while (j != latencies.end() && i != in.end()) {
|
||||
count++;
|
||||
@ -31,22 +31,22 @@ void TestOpStat::TypeStatus::export_latencies(map<double,uint64_t> &in) const
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::ostream & operator<<(std::ostream &out, const TestOpStat &rhs)
|
||||
{
|
||||
std::lock_guard l{rhs.stat_lock};
|
||||
for (auto i = rhs.stats.begin();
|
||||
i != rhs.stats.end();
|
||||
++i) {
|
||||
map<double,uint64_t> latency;
|
||||
std::map<double,uint64_t> latency;
|
||||
latency[10] = 0;
|
||||
latency[50] = 0;
|
||||
latency[90] = 0;
|
||||
latency[99] = 0;
|
||||
i->second.export_latencies(latency);
|
||||
|
||||
|
||||
out << i->first << " latency: " << std::endl;
|
||||
for (map<double,uint64_t>::iterator j = latency.begin();
|
||||
for (auto j = latency.begin();
|
||||
j != latency.end();
|
||||
++j) {
|
||||
if (j->second == 0) break;
|
||||
|
Loading…
Reference in New Issue
Block a user