benchmark silo added
[c11concurrency-benchmarks.git] / silo / masstree / kvproto.hh
1 /* Masstree
2  * Eddie Kohler, Yandong Mao, Robert Morris
3  * Copyright (c) 2012-2013 President and Fellows of Harvard College
4  * Copyright (c) 2012-2013 Massachusetts Institute of Technology
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, subject to the conditions
9  * listed in the Masstree LICENSE file. These conditions include: you must
10  * preserve this copyright notice, and you cannot mention the copyright
11  * holders in advertising related to the Software without their permission.
12  * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13  * notice is a summary of the Masstree LICENSE file; the license in that file
14  * is legally binding.
15  */
16 #ifndef KVPROTO_HH
17 #define KVPROTO_HH
18 #include "compiler.hh"
19
20 enum {
21     Cmd_None = 0,
22     Cmd_Get = 2,
23     Cmd_Scan = 4,
24     Cmd_Put = 6,
25     Cmd_Replace = 8,
26     Cmd_Remove = 10,
27     Cmd_Checkpoint = 12,
28     Cmd_Handshake = 14,
29     Cmd_Max
30 };
31
32 enum result_t {
33     NotFound = -2,
34     Retry,
35     OutOfDate,
36     Inserted,
37     Updated,
38     Found,
39     ScanDone
40 };
41
42 enum ckptrav_order_t {
43     ckptrav_inorder = 0,
44     ckptrav_preorder
45 };
46
47 struct row_marker {
48     enum { mt_remove = 1, mt_delta = 2 };
49     int marker_type_;
50 };
51
52 template <typename R>
53 inline bool row_is_marker(const R* row) {
54     return row->timestamp() & 1;
55 }
56
57 #endif