int Binlog::load(const rocksdb::Slice &s){ if(s.size() < HEADER_LEN){ return -1; } buf.assign(s.data(), s.size()); return 0; }
static inline uint64_t decode_seq_key(const rocksdb::Slice &key){ uint64_t seq = 0; if(key.size() == (sizeof(uint64_t) + 1) && key.data()[0] == DataType::SYNCLOG){ seq = *((uint64_t *)(key.data() + 1)); seq = big_endian(seq); } return seq; }
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; } }
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; } }
/** * Merge two EWAH bitmasks assuming that they are already * padded to word boundaries - concatenate except adding the last two sets of 64-bit longs. */ bool EWAHMergeOperator::Merge( const rocksdb::Slice &key, const rocksdb::Slice *existing_value, const rocksdb::Slice &value, std::string *new_value, rocksdb::Logger *logger) const { assert(new_value); new_value->clear(); if (existing_value) { new_value->append(existing_value->data(), existing_value->size()); EWAHBoolArray<dullahan::models::bitarrayword>::concatStreams(new_value, value.data(), value.size()); } else { new_value->append(value.data(), value.size()); } return true; }
DiskLoc RocksRecordStore::_makeDiskLoc( const rocksdb::Slice& slice ) { return reinterpret_cast<const DiskLoc*>( slice.data() )[0]; }
Binlog::Binlog(uint64_t seq, char type, char cmd, const rocksdb::Slice &key){ buf.append((char *)(&seq), sizeof(uint64_t)); buf.push_back(type); buf.push_back(cmd); buf.append(key.data(), key.size()); }
void ReleaseKey( rocksdb::Slice &aKey ) { const char *keyData = aKey.data(); delete keyData; aKey.clear(); }