Exemplo n.º 1
0
void RocksRecoveryUnit::incrementCounter(const rocksdb::Slice& counterKey,
                                         std::atomic<long long>* counter,
                                         long long delta) {
    if (delta == 0) {
        return;
    }

    auto pair = _deltaCounters.find(counterKey.ToString());
    if (pair == _deltaCounters.end()) {
        _deltaCounters[counterKey.ToString()] = mongo::RocksRecoveryUnit::Counter(counter, delta);
    } else {
        pair->second._delta += delta;
    }
}
Exemplo n.º 2
0
long long RocksRecoveryUnit::getDeltaCounter(const rocksdb::Slice& counterKey) {
    auto counter = _deltaCounters.find(counterKey.ToString());
    if (counter == _deltaCounters.end()) {
        return 0;
    } else {
        return counter->second._delta;
    }
}