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; }
/** * 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; }
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()); }