Merge branch 'master' into columnfamilies

This commit is contained in:
Igor Canadi
2014-03-04 09:39:14 -08:00
10 changed files with 323 additions and 17 deletions

View File

@@ -39,12 +39,12 @@ class Arena {
// Returns an estimate of the total memory usage of data allocated
// by the arena (exclude the space allocated but not yet used for future
// allocations).
const size_t ApproximateMemoryUsage() {
size_t ApproximateMemoryUsage() const {
return blocks_memory_ + blocks_.capacity() * sizeof(char*) -
alloc_bytes_remaining_;
}
const size_t MemoryAllocatedBytes() { return blocks_memory_; }
size_t MemoryAllocatedBytes() const { return blocks_memory_; }
private:
// Number of bytes allocated in one block

View File

@@ -46,5 +46,4 @@ uint32_t Hash(const char* data, size_t n, uint32_t seed) {
return h;
}
} // namespace rocksdb

View File

@@ -11,6 +11,7 @@
*/
#pragma once
#include <stdint.h>
#include "rocksdb/slice.h"
#if defined(__x86_64__)
#define MURMUR_HASH MurmurHash64A
@@ -29,5 +30,13 @@ typedef unsigned int murmur_t;
unsigned int MurmurHashNeutral2 ( const void * key, int len, unsigned int seed );
#define MurmurHash MurmurHashNeutral2
typedef unsigned int murmur_t;
#endif
// Allow slice to be hashable by murmur hash.
namespace rocksdb {
struct murmur_hash {
size_t operator()(const Slice& slice) const {
return MurmurHash(slice.data(), slice.size(), 0);
}
};
} // rocksdb