}
}
+ int approx_size() const {
+ return 6 + 1 +
+ 4 + prefix.size() +
+ 4 + key.size() +
+ 4 + endkey.size() +
+ 4 + bl.length();
+ }
+
static void generate_test_instances(list<Op*>& ls) {
ls.push_back(new Op);
// we get coverage here from the Transaction instances
list<Op> ops;
uint64_t bytes, keys;
- Transaction() : bytes(0), keys(0) {}
+ Transaction() : bytes(6 + 4 + 8*2), keys(0) {}
enum {
OP_PUT = 1,
void put(const string& prefix, const string& key, const bufferlist& bl) {
ops.push_back(Op(OP_PUT, prefix, key, bl));
++keys;
- bytes += prefix.length() + key.length() + bl.length();
+ bytes += ops.back().approx_size();
}
void put(const string& prefix, version_t ver, const bufferlist& bl) {
void erase(const string& prefix, const string& key) {
ops.push_back(Op(OP_ERASE, prefix, key));
++keys;
- bytes += prefix.length() + key.length();
+ bytes += ops.back().approx_size();
}
void erase(const string& prefix, version_t ver) {
const string& end) {
ops.push_back(Op(OP_ERASE_RANGE, prefix, begin, end));
++keys;
- bytes += prefix.length() + begin.length() + end.length();
+ bytes += ops.back().approx_size();
}
void compact_prefix(const string& prefix) {