return store->time_log_add(oid, now, section, key, bl);
}
-int RGWMetadataLog::get_log_shard_id(RGWMetadataHandler *handler, const string& section, const string& key)
-{
- string oid;
-
- string hash_key;
- handler->get_hash_key(section, key, hash_key);
-
- int shard_id;
- store->shard_name(prefix, cct->_conf->rgw_md_log_max_shards, hash_key, oid, &shard_id);
-
- return shard_id;
-}
-
int RGWMetadataLog::store_entries_in_shard(list<cls_log_entry>& entries, int shard_id, librados::AioCompletion *completion)
{
string oid;
return 0;
}
+int RGWMetadataManager::get_log_shard_id(const string& section,
+ const string& key, int *shard_id)
+{
+ RGWMetadataHandler *handler = get_handler(section);
+ if (!handler) {
+ return -EINVAL;
+ }
+ string hash_key;
+ handler->get_hash_key(section, key, hash_key);
+ *shard_id = store->key_to_shard_id(hash_key, cct->_conf->rgw_md_log_max_shards);
+ return 0;
+}
lock("RGWMetaLog::lock") {}
int add_entry(RGWMetadataHandler *handler, const string& section, const string& key, bufferlist& bl);
- int get_log_shard_id(RGWMetadataHandler *handler, const string& section, const string& key);
int store_entries_in_shard(list<cls_log_entry>& entries, int shard_id, librados::AioCompletion *completion);
struct LogListCtx {
int lock_exclusive(string& metadata_key, utime_t duration, string& owner_id);
int unlock(string& metadata_key, string& owner_id);
- int get_log_shard_id(const string& section, const std::string& period,
- const string& key, int *shard_id) {
- RGWMetadataHandler *handler = get_handler(section);
- if (!handler) {
- return -EINVAL;
- }
- auto md_log = get_log(period);
- *shard_id = md_log->get_log_shard_id(handler, section, key);
- return 0;
- }
+ int get_log_shard_id(const string& section, const string& key, int *shard_id);
};
#endif