reformat source code
according to code styles, 'AccessModifierOffset' should be -2.
This commit is contained in:
10
deps/oblib/unittest/lib/hash/hash_benz.cpp
vendored
10
deps/oblib/unittest/lib/hash/hash_benz.cpp
vendored
@ -48,7 +48,7 @@ struct value_t {
|
||||
class allocer_t {
|
||||
const static uint32_t BLOCK_SIZE = 1024 * 1024;
|
||||
|
||||
public:
|
||||
public:
|
||||
allocer_t()
|
||||
{
|
||||
cur_buffer_pos_ = 0;
|
||||
@ -81,13 +81,13 @@ class allocer_t {
|
||||
void inc_ref(){};
|
||||
void dec_ref(){};
|
||||
|
||||
private:
|
||||
private:
|
||||
uint32_t cur_buffer_pos_;
|
||||
char* cur_buffer_;
|
||||
};
|
||||
|
||||
class hashfunc_t {
|
||||
public:
|
||||
public:
|
||||
uint64_t operator()(uint64_t key)
|
||||
{
|
||||
return key;
|
||||
@ -95,7 +95,7 @@ class hashfunc_t {
|
||||
};
|
||||
|
||||
class getkey_t {
|
||||
public:
|
||||
public:
|
||||
uint64_t operator()(const value_t& v)
|
||||
{
|
||||
return v.key;
|
||||
@ -103,7 +103,7 @@ class getkey_t {
|
||||
};
|
||||
|
||||
class equal_t {
|
||||
public:
|
||||
public:
|
||||
bool operator()(uint64_t k1, uint64_t k2)
|
||||
{
|
||||
return (k1 == k2);
|
||||
|
||||
@ -50,7 +50,7 @@ typedef ObConcurrentHashMap<Key, int64_t> HashMap;
|
||||
|
||||
int64_t create_num = 0;
|
||||
class ObStressThread : public lib::ThreadPool {
|
||||
public:
|
||||
public:
|
||||
ObStressThread()
|
||||
{}
|
||||
void run1()
|
||||
@ -66,7 +66,7 @@ class ObStressThread : public lib::ThreadPool {
|
||||
}
|
||||
HashMap* hashmap;
|
||||
|
||||
private:
|
||||
private:
|
||||
obsys::CThreadMutex mutex;
|
||||
};
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ struct Adder {
|
||||
typedef ObConcurrentHashMapWithHazardValue<Key, int64_t*> HashMap;
|
||||
|
||||
class ValueAlloc : public HashMap::IValueAlloc {
|
||||
public:
|
||||
public:
|
||||
int64_t* alloc()
|
||||
{
|
||||
return op_alloc(int64_t);
|
||||
@ -61,7 +61,7 @@ class ValueAlloc : public HashMap::IValueAlloc {
|
||||
}
|
||||
};
|
||||
class ValueReclaim : public HashMap::IValueReclaimCallback {
|
||||
public:
|
||||
public:
|
||||
ValueReclaim() : reclaimed_num(0)
|
||||
{}
|
||||
void reclaim_value(int64_t* value)
|
||||
@ -126,7 +126,7 @@ TEST(TestObConcurrentHashMapWithHazardValue, hazard_value)
|
||||
|
||||
int64_t create_num = 0;
|
||||
class ObStressThread : public cotesting::DefaultRunnable {
|
||||
public:
|
||||
public:
|
||||
ObStressThread() : finished_count(0)
|
||||
{}
|
||||
void run1() final
|
||||
@ -174,7 +174,7 @@ class ObStressThread : public cotesting::DefaultRunnable {
|
||||
}
|
||||
HashMap* hashmap;
|
||||
|
||||
private:
|
||||
private:
|
||||
obsys::CThreadMutex mutex;
|
||||
int finished_count;
|
||||
};
|
||||
|
||||
@ -18,7 +18,7 @@ using namespace oceanbase;
|
||||
using namespace oceanbase::common;
|
||||
|
||||
struct Key {
|
||||
public:
|
||||
public:
|
||||
Key() : key_(0)
|
||||
{}
|
||||
explicit Key(int64_t k) : key_(k)
|
||||
@ -36,7 +36,7 @@ struct Key {
|
||||
};
|
||||
|
||||
struct MacroKey {
|
||||
public:
|
||||
public:
|
||||
static const uint64_t HASH_MAGIC_NUM = 2654435761;
|
||||
MacroKey() : key_(0)
|
||||
{}
|
||||
@ -55,7 +55,7 @@ struct MacroKey {
|
||||
};
|
||||
|
||||
struct BadKey {
|
||||
public:
|
||||
public:
|
||||
BadKey() : key_(0)
|
||||
{}
|
||||
explicit BadKey(int64_t k) : key_(k)
|
||||
@ -73,7 +73,7 @@ struct BadKey {
|
||||
};
|
||||
|
||||
struct ModKey {
|
||||
public:
|
||||
public:
|
||||
ModKey() : key_(0)
|
||||
{}
|
||||
explicit ModKey(int64_t k) : key_(k)
|
||||
@ -91,7 +91,7 @@ struct ModKey {
|
||||
};
|
||||
|
||||
struct Value {
|
||||
public:
|
||||
public:
|
||||
Value() : value_(0)
|
||||
{}
|
||||
explicit Value(int64_t v) : value_(v)
|
||||
@ -109,7 +109,7 @@ struct Value {
|
||||
};
|
||||
|
||||
class TestCuckooHashMap : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
TestCuckooHashMap();
|
||||
virtual ~TestCuckooHashMap();
|
||||
};
|
||||
|
||||
@ -17,21 +17,21 @@
|
||||
using namespace oceanbase::common;
|
||||
using namespace oceanbase::common::hash;
|
||||
class ObExtIterHashSetTest : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
ObExtIterHashSetTest();
|
||||
virtual ~ObExtIterHashSetTest();
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
public:
|
||||
public:
|
||||
ObArenaAllocator allocator_;
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
ObExtIterHashSetTest(const ObExtIterHashSetTest& other);
|
||||
ObExtIterHashSetTest& operator=(const ObExtIterHashSetTest& other);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// data members
|
||||
};
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ typedef uint64_t HashKey;
|
||||
typedef uint64_t HashValue;
|
||||
|
||||
class CallBack {
|
||||
public:
|
||||
public:
|
||||
void operator()(HashMapPair<HashKey, HashValue>& v)
|
||||
{
|
||||
v.second = v_;
|
||||
@ -41,7 +41,7 @@ class CallBack {
|
||||
v_ = v;
|
||||
};
|
||||
|
||||
private:
|
||||
private:
|
||||
HashValue v_;
|
||||
};
|
||||
|
||||
|
||||
@ -15,18 +15,18 @@
|
||||
using namespace oceanbase::common;
|
||||
using namespace oceanbase::common::hash;
|
||||
class TestIteratableHashMap : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
TestIteratableHashMap();
|
||||
virtual ~TestIteratableHashMap();
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
TestIteratableHashMap(const TestIteratableHashMap& other);
|
||||
TestIteratableHashMap& operator=(const TestIteratableHashMap& other);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// data members
|
||||
};
|
||||
|
||||
|
||||
@ -17,18 +17,18 @@
|
||||
using namespace oceanbase::common;
|
||||
using namespace oceanbase::common::hash;
|
||||
class ObIteratableHashSetTest : public ::testing::Test {
|
||||
public:
|
||||
public:
|
||||
ObIteratableHashSetTest();
|
||||
virtual ~ObIteratableHashSetTest();
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
ObIteratableHashSetTest(const ObIteratableHashSetTest& other);
|
||||
ObIteratableHashSetTest& operator=(const ObIteratableHashSetTest& other);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// data members
|
||||
};
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ namespace unittest {
|
||||
// Test Key type.
|
||||
// 8B Key, 8B Value.
|
||||
class UnitTestKey {
|
||||
public:
|
||||
public:
|
||||
uint64_t key;
|
||||
uint64_t hash() const
|
||||
{
|
||||
@ -92,7 +92,7 @@ class UnitTestKey {
|
||||
};
|
||||
|
||||
class UnitTestValue {
|
||||
public:
|
||||
public:
|
||||
uint64_t val;
|
||||
bool operator==(const UnitTestValue& other) const
|
||||
{
|
||||
@ -577,7 +577,7 @@ TEST(ObLinearHashMap, ACCSStest5)
|
||||
// Performance tests.
|
||||
// Test Key type.
|
||||
class PerfTestKey {
|
||||
public:
|
||||
public:
|
||||
uint64_t key;
|
||||
uint64_t data;
|
||||
uint64_t hash() const
|
||||
@ -591,7 +591,7 @@ class PerfTestKey {
|
||||
};
|
||||
|
||||
class PerfTestValue {
|
||||
public:
|
||||
public:
|
||||
uint64_t val;
|
||||
};
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ using namespace common;
|
||||
using namespace hash;
|
||||
|
||||
class HashKey {
|
||||
public:
|
||||
public:
|
||||
HashKey() : v_(0)
|
||||
{}
|
||||
HashKey(uint64_t v) : v_(v)
|
||||
@ -49,7 +49,7 @@ class HashKey {
|
||||
};
|
||||
|
||||
class HashValue : public LinkHashValue<HashKey> {
|
||||
public:
|
||||
public:
|
||||
HashValue() : v_(0)
|
||||
{}
|
||||
HashValue(uint64_t v) : v_(v)
|
||||
@ -69,7 +69,7 @@ ObMemAttr attr(1001, ObNewModIds::OB_MEMSTORE);
|
||||
class TestAllocHandle {
|
||||
typedef LinkHashNode<HashKey> Node;
|
||||
|
||||
public:
|
||||
public:
|
||||
HashValue* alloc_value()
|
||||
{
|
||||
ATOMIC_INC(&value_alloc);
|
||||
@ -100,7 +100,7 @@ class TestAllocHandle {
|
||||
};
|
||||
|
||||
class AtomicGetFunctor {
|
||||
public:
|
||||
public:
|
||||
explicit AtomicGetFunctor() : ret_val_(0)
|
||||
{}
|
||||
void operator()(const HashKey& key, HashValue* value)
|
||||
|
||||
@ -58,7 +58,7 @@ struct Node : public ObPreAllocLinkHashNode<int64_t, Item> {
|
||||
};
|
||||
|
||||
class ItemProtector {
|
||||
public:
|
||||
public:
|
||||
static void hold(Item& item)
|
||||
{
|
||||
++item.ref_;
|
||||
@ -116,7 +116,7 @@ struct TestForeachCheckRef : public TestMap::ForeachFunctor {
|
||||
class TestEraseChecker : public TestMap::EraseChecker
|
||||
|
||||
{
|
||||
public:
|
||||
public:
|
||||
virtual ~TestEraseChecker()
|
||||
{}
|
||||
virtual int operator()(Item& item)
|
||||
@ -130,7 +130,7 @@ class TestEraseChecker : public TestMap::EraseChecker
|
||||
};
|
||||
|
||||
class TestGetFunctor : public TestMap::GetFunctor {
|
||||
public:
|
||||
public:
|
||||
TestGetFunctor() : item_(NULL)
|
||||
{}
|
||||
virtual ~TestGetFunctor()
|
||||
@ -148,7 +148,7 @@ class TestGetFunctor : public TestMap::GetFunctor {
|
||||
}
|
||||
Item* item_;
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(TestGetFunctor);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user