set<hobject_t> temp_added;
set<hobject_t> temp_cleared;
ObjectStore::Transaction *t;
+ uint64_t written;
const coll_t &get_coll_ct(const hobject_t &hoid) {
if (hoid.is_temp()) {
temp_cleared.erase(hoid);
}
public:
RPGTransaction(coll_t coll, coll_t temp_coll)
- : coll(coll), temp_coll(temp_coll), t(new ObjectStore::Transaction)
+ : coll(coll), temp_coll(temp_coll), t(new ObjectStore::Transaction), written(0)
{}
/// Yields ownership of contained transaction
uint64_t len,
bufferlist &bl
) {
+ written += len;
t->write(get_coll_ct(hoid), hoid, off, len, bl);
}
void remove(
const hobject_t &hoid,
map<string, bufferlist> &keys
) {
+ for (map<string, bufferlist>::iterator p = keys.begin(); p != keys.end(); p++)
+ written += p->first.length() + p->second.length();
return t->omap_setkeys(get_coll(hoid), hoid, keys);
}
void omap_rmkeys(
const hobject_t &hoid,
bufferlist &header
) {
+ written += header.length();
t->omap_setheader(get_coll(hoid), hoid, header);
}
void clone_range(
) {
RPGTransaction *to_append = dynamic_cast<RPGTransaction*>(_to_append);
assert(to_append);
+ written += to_append->written;
+ to_append->written = 0;
t->append(*(to_append->t));
for (set<hobject_t>::iterator i = to_append->temp_added.begin();
i != to_append->temp_added.end();
return t->empty();
}
uint64_t get_bytes_written() const {
- return t->get_encoded_bytes();
+ return written;
}
~RPGTransaction() { delete t; }
};