1
0
Fork 0

change rocksdbkey for geoindex

This commit is contained in:
Jan Christoph Uhde 2017-05-08 12:34:53 +02:00
parent 81a5a39e22
commit 13f2cd4cb9
2 changed files with 5 additions and 4 deletions

View File

@ -306,15 +306,16 @@ RocksDBKey::RocksDBKey(RocksDBEntryType type, uint64_t first,
} }
} }
RocksDBKey::RocksDBKey(RocksDBEntryType type, bool isSlot, uint64_t offset) RocksDBKey::RocksDBKey(RocksDBEntryType type, uint64_t objectId, uint64_t offset, bool isSlot)
: _type(type), _buffer() { : _type(type), _buffer() {
switch (_type) { switch (_type) {
case RocksDBEntryType::GeoIndexValue: { case RocksDBEntryType::GeoIndexValue: {
size_t length = sizeof(char) + sizeof(isSlot) + sizeof(offset); size_t length = sizeof(char) + sizeof(objectId) + sizeof(offset);
_buffer.reserve(length); _buffer.reserve(length);
_buffer.push_back(static_cast<char>(_type)); _buffer.push_back(static_cast<char>(_type));
_buffer.append(isSlot, sizeof(isSlot)); offset |= std::uint64_t{isSlot} << 63; //encode slot|pot in highest bit
uint64ToPersistent(_buffer, objectId);
uint64ToPersistent(_buffer, offset); uint64ToPersistent(_buffer, offset);
break; break;
} }

View File

@ -240,7 +240,7 @@ class RocksDBKey {
std::string const& third); std::string const& third);
RocksDBKey(RocksDBEntryType type, uint64_t first, arangodb::StringRef const& second, RocksDBKey(RocksDBEntryType type, uint64_t first, arangodb::StringRef const& second,
arangodb::StringRef const& third); arangodb::StringRef const& third);
RocksDBKey(RocksDBEntryType type, bool, uint64_t); RocksDBKey(RocksDBEntryType type, uint64_t objectId, uint64_t index, bool isSlot);
private: private:
static RocksDBEntryType type(char const* data, size_t size); static RocksDBEntryType type(char const* data, size_t size);