tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
boostinglist.h
Go to the documentation of this file.
1 #ifndef BOOSTINGLIST_H
2 #define BOOSTINGLIST_H
3 
4 #include <vector>
5 #include "boosting/lockkey.h"
7 #include "common/assert.h"
8 
9 
11 {
12  enum OpType
13  {
14  FIND = 0,
17  };
18 
19  struct Operation
20  {
21  Operation() : type(0), key(0){}
22  Operation(uint8_t _type, uint32_t _key) : type(_type), key(_key){}
23 
24  uint8_t type;
25  uint32_t key;
26  };
27 
28  typedef std::vector<Operation> LogType;
29 
30 public:
32  {
33  OK = 0,
36  };
37 
38 
39 public:
40  ~BoostingList();
41 
42  void Init();
43 
44  void Uninit();
45 
46  ReturnCode Insert(uint32_t key);
47 
48  ReturnCode Delete(uint32_t key);
49 
50  ReturnCode Find(uint32_t key);
51 
52  void OnAbort(ReturnCode ret);
53 
54  void OnCommit();
55 
56  void Print();
57 
58 private:
61  static __thread LogType* m_log;
62 
64  (
65  uint32_t g_count = 0;
66  uint32_t g_count_ins = 0;
67  uint32_t g_count_del = 0;
68  uint32_t g_count_fnd = 0;
69  )
70 
71  uint32_t g_count_commit = 0;
72  uint32_t g_count_abort = 0;
73  uint32_t g_count_fake_abort = 0;
74 };
75 
76 #endif /* end of include guard: BOOSTINGLIST_H */
Definition: boostinglist.h:33
ReturnCode Find(uint32_t key)
Definition: boostinglist.cc:63
ReturnCode Insert(uint32_t key)
Definition: boostinglist.cc:29
Definition: boostinglist.h:16
Definition: boostinglist.h:35
Definition: boostinglist.h:10
ReturnCode Delete(uint32_t key)
Definition: boostinglist.cc:46
ASSERT_CODE(uint32_t g_count=0;uint32_t g_count_ins=0;uint32_t g_count_del=0;uint32_t g_count_fnd=0;) uint32_t g_count_commit=0
Definition: boostinglist.h:19
static __thread LogType * m_log
Definition: boostinglist.h:61
LockKey m_lock
Definition: boostinglist.h:60
Definition: boostinglist.h:15
void Init()
Definition: boostinglist.cc:16
Operation()
Definition: boostinglist.h:21
Definition: lockfreelist.h:11
Operation(uint8_t _type, uint32_t _key)
Definition: boostinglist.h:22
static uint32_t g_count_commit
Definition: stmskip.cc:38
bool ret
Definition: stmskip.cc:242
Definition: boostinglist.h:14
~BoostingList()
Definition: boostinglist.cc:5
ReturnCode
Definition: boostinglist.h:31
void Print()
Definition: boostinglist.cc:121
uint32_t g_count_fake_abort
Definition: boostinglist.h:73
void Uninit()
Definition: boostinglist.cc:23
LockfreeList m_list
Definition: boostinglist.h:59
uint8_t type
Definition: boostinglist.h:24
OpType
Definition: boostinglist.h:12
Definition: lockkey.h:9
void OnCommit()
Definition: boostinglist.cc:113
uint32_t key
Definition: boostinglist.h:25
Definition: boostinglist.h:34
std::vector< Operation > LogType
Definition: boostinglist.h:28
void OnAbort(ReturnCode ret)
Definition: boostinglist.cc:78
uint32_t g_count_abort
Definition: boostinglist.h:72