* would be located in (root)/2/D/0/
*
* Subdirectories are created when the number of objects in a
- * directory exceed 16 * (abs(merge_threshhold)) * split_multiplier +
+ * directory exceed 16 * (abs(merge_threshhold) * split_multiplier +
* split_rand_factor). The number of objects in a directory is encoded
* as subdir_info_s in an xattr on the directory.
*/
void encode(bufferlist &bl) const
{
+ using ceph::encode;
__u8 v = 1;
- ::encode(v, bl);
- ::encode(objs, bl);
- ::encode(subdirs, bl);
- ::encode(hash_level, bl);
+ encode(v, bl);
+ encode(objs, bl);
+ encode(subdirs, bl);
+ encode(hash_level, bl);
}
- void decode(bufferlist::iterator &bl)
+ void decode(bufferlist::const_iterator &bl)
{
+ using ceph::decode;
__u8 v;
- ::decode(v, bl);
- assert(v == 1);
- ::decode(objs, bl);
- ::decode(subdirs, bl);
- ::decode(hash_level, bl);
+ decode(v, bl);
+ ceph_assert(v == 1);
+ decode(objs, bl);
+ decode(subdirs, bl);
+ decode(hash_level, bl);
}
};
settings_s() : split_rand_factor(0) {}
void encode(bufferlist &bl) const
{
+ using ceph::encode;
__u8 v = 1;
- ::encode(v, bl);
- ::encode(split_rand_factor, bl);
+ encode(v, bl);
+ encode(split_rand_factor, bl);
}
- void decode(bufferlist::iterator &bl)
+ void decode(bufferlist::const_iterator &bl)
{
+ using ceph::decode;
__u8 v;
- ::decode(v, bl);
- ::decode(split_rand_factor, bl);
+ decode(v, bl);
+ decode(split_rand_factor, bl);
}
} settings;
InProgressOp(int op, const vector<string> &path)
: op(op), path(path) {}
- explicit InProgressOp(bufferlist::iterator &bl) {
+ explicit InProgressOp(bufferlist::const_iterator &bl) {
decode(bl);
}
bool is_merge() const { return op == MERGE; }
void encode(bufferlist &bl) const {
+ using ceph::encode;
__u8 v = 1;
- ::encode(v, bl);
- ::encode(op, bl);
- ::encode(path, bl);
+ encode(v, bl);
+ encode(op, bl);
+ encode(path, bl);
}
- void decode(bufferlist::iterator &bl) {
+ void decode(bufferlist::const_iterator &bl) {
+ using ceph::decode;
__u8 v;
- ::decode(v, bl);
- assert(v == 1);
- ::decode(op, bl);
- ::decode(path, bl);
+ decode(v, bl);
+ ceph_assert(v == 1);
+ decode(op, bl);
+ decode(path, bl);
}
};
CephContext* cct,
coll_t collection, ///< [in] Collection
const char *base_path, ///< [in] Path to the index root.
- int merge_at, ///< [in] Merge threshhold.
- int split_multiple, ///< [in] Split threshhold.
+ int merge_at, ///< [in] Merge threshold.
+ int split_multiple, ///< [in] Split threshold.
uint32_t index_version,///< [in] Index version
double retry_probability=0) ///< [in] retry probability
: LFNIndex(cct, collection, base_path, index_version, retry_probability),
CollectionIndex* dest
) override;
+ /// @see CollectionIndex
+ int _merge(
+ uint32_t bits,
+ CollectionIndex* dest
+ ) override;
+
+ int _merge_dirs(
+ HashIndex& from,
+ HashIndex& to,
+ const vector<string>& path);
+
/// @see CollectionIndex
int apply_layout_settings(int target_level) override;
/// Convert a number to hex string (upper case).
static string to_hex(int n) {
- assert(n >= 0 && n < 16);
+ ceph_assert(n >= 0 && n < 16);
char c = (n <= 9 ? ('0' + n) : ('A' + n - 10));
string str;
str.append(1, c);
struct CmpPairBitwise {
bool operator()(const pair<string, ghobject_t>& l,
- const pair<string, ghobject_t>& r)
+ const pair<string, ghobject_t>& r) const
{
if (l.first < r.first)
return true;
};
struct CmpHexdigitStringBitwise {
- bool operator()(const string& l, const string& r) {
+ bool operator()(const string& l, const string& r) const {
return reverse_hexdigit_bits_string(l) < reverse_hexdigit_bits_string(r);
}
};