change getKey() interface, pass in uint8_t * only

This commit is contained in:
mengranwo 2019-12-06 14:59:40 -08:00
parent 6836e370a7
commit 115ff8bf65
3 changed files with 7 additions and 7 deletions

View File

@ -218,7 +218,7 @@ public:
if (rowLimit >= 0) { if (rowLimit >= 0) {
auto it = data.lower_bound(keys.begin); auto it = data.lower_bound(keys.begin);
while (it != data.end() && rowLimit && byteLimit >= 0) { while (it != data.end() && rowLimit && byteLimit >= 0) {
StringRef tempKey = it.getKey(reserved_buffer, CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT); StringRef tempKey = it.getKey(reserved_buffer);
if (tempKey >= keys.end) break; if (tempKey >= keys.end) break;
byteLimit -= sizeof(KeyValueRef) + tempKey.size() + it.getValue().size(); byteLimit -= sizeof(KeyValueRef) + tempKey.size() + it.getValue().size();
@ -230,7 +230,7 @@ public:
rowLimit = -rowLimit; rowLimit = -rowLimit;
auto it = data.previous(data.lower_bound(keys.end)); auto it = data.previous(data.lower_bound(keys.end));
while (it != data.end() && rowLimit && byteLimit >= 0) { while (it != data.end() && rowLimit && byteLimit >= 0) {
StringRef tempKey = it.getKey(reserved_buffer, CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT); StringRef tempKey = it.getKey(reserved_buffer);
if (tempKey < keys.begin) break; if (tempKey < keys.begin) break;
byteLimit -= sizeof(KeyValueRef) + tempKey.size() + it.getValue().size(); byteLimit -= sizeof(KeyValueRef) + tempKey.size() + it.getValue().size();
@ -596,7 +596,7 @@ private:
int count = 0; int count = 0;
int64_t snapshotSize = 0; int64_t snapshotSize = 0;
for (auto kv = snapshotData.begin(); kv != snapshotData.end(); ++kv) { for (auto kv = snapshotData.begin(); kv != snapshotData.end(); ++kv) {
StringRef tempKey = kv.getKey(reserved_buffer, CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT); StringRef tempKey = kv.getKey(reserved_buffer);
log_op(OpSnapshotItem, tempKey, kv.getValue()); log_op(OpSnapshotItem, tempKey, kv.getValue());
snapshotSize += tempKey.size() + kv.getValue().size() + OP_DISK_OVERHEAD; snapshotSize += tempKey.size() + kv.getValue().size() + OP_DISK_OVERHEAD;
++count; ++count;
@ -669,7 +669,7 @@ private:
snapshotTotalWrittenBytes += OP_DISK_OVERHEAD; snapshotTotalWrittenBytes += OP_DISK_OVERHEAD;
} else { } else {
StringRef tempKey = next.getKey(self->reserved_buffer, CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT); StringRef tempKey = next.getKey(self->reserved_buffer);
self->log_op(OpSnapshotItem, tempKey, next.getValue()); self->log_op(OpSnapshotItem, tempKey, next.getValue());
nextKey = tempKey; nextKey = tempKey;
nextKeyAfter = true; nextKeyAfter = true;

View File

@ -96,7 +96,7 @@ public:
bool operator != ( const iterator& r ) const { return i != r.i; } bool operator != ( const iterator& r ) const { return i != r.i; }
// following two methods are for memory storage engine(KeyValueStoreMemory class) use only // following two methods are for memory storage engine(KeyValueStoreMemory class) use only
// in order to have same interface as radixtree // in order to have same interface as radixtree
StringRef& getKey(uint8_t* dummyContent, int dummyLen) const { return i->data.key; } StringRef& getKey(uint8_t* dummyContent) const { return i->data.key; }
StringRef& getValue() const { return i->data.value; } StringRef& getValue() const { return i->data.value; }
}; };

View File

@ -239,7 +239,7 @@ public:
const iterator& operator--(); const iterator& operator--();
bool operator != (const iterator &lhs) const; bool operator != (const iterator &lhs) const;
bool operator == (const iterator &lhs) const; bool operator == (const iterator &lhs) const;
StringRef getKey(uint8_t* content, int len) const; StringRef getKey(uint8_t* content) const;
StringRef getValue() const { StringRef getValue() const {
ASSERT(m_pointee->m_is_leaf); ASSERT(m_pointee->m_is_leaf);
return ((leafNode*)m_pointee)->getValue(); return ((leafNode*)m_pointee)->getValue();
@ -565,7 +565,7 @@ const radix_tree::iterator& radix_tree::iterator::operator--() {
/* /*
* reconstruct the key * reconstruct the key
*/ */
StringRef radix_tree::iterator::getKey(uint8_t* content, int len) const { StringRef radix_tree::iterator::getKey(uint8_t* content) const {
if (m_pointee == NULL) return StringRef(); if (m_pointee == NULL) return StringRef();
ASSERT(m_pointee->m_is_leaf); ASSERT(m_pointee->m_is_leaf);