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