Zero  0.1.0
tpcc_schema_man.h
Go to the documentation of this file.
1 /* -*- mode:C++; c-basic-offset:4 -*-
2  Shore-kits -- Benchmark implementations for Shore-MT
3 
4  Copyright (c) 2007-2009
5  Data Intensive Applications and Systems Labaratory (DIAS)
6  Ecole Polytechnique Federale de Lausanne
7 
8  All Rights Reserved.
9 
10  Permission to use, copy, modify and distribute this software and
11  its documentation is hereby granted, provided that both the
12  copyright notice and this permission notice appear in all copies of
13  the software, derivative works or modified versions, and any
14  portions thereof, and that both notices appear in supporting
15  documentation.
16 
17  This code is distributed in the hope that it will be useful, but
18  WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS
20  DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
21  RESULTING FROM THE USE OF THIS SOFTWARE.
22 */
23 
32 #ifndef __TPCC_SCHEMA_MAN_H
33 #define __TPCC_SCHEMA_MAN_H
34 
35 #include "scan.h"
36 #include "tpcc_struct.h"
37 #include "tpcc_schema.h"
38 
39 namespace tpcc {
40 
41 /* ------------------------------------------------------------------ */
42 /* --- The managers of all the tables used in the TPC-C benchmark --- */
43 /* ------------------------------------------------------------------ */
44 
45 
46  class warehouse_man_impl : public table_man_t<warehouse_t> {
48 
49  public:
50 
51  warehouse_man_impl(warehouse_t* aWarehouseDesc)
52  : table_man_t<warehouse_t>(aWarehouseDesc) {}
53 
55 
56  // --- access specific tuples --- //
58  warehouse_tuple* ptuple,
59  const int w_id);
60 
62  warehouse_tuple* ptuple,
63  const int w_id);
64 
65  // --- update a retrieved tuple --- //
67  warehouse_tuple* ptuple,
68  const double h_amount
69  );
70  }; // EOF: warehouse_man_impl
71 
72 
73 
74  class district_man_impl : public table_man_t<district_t> {
76 
77  public:
78 
79  district_man_impl(district_t* aDistrictDesc)
80  : table_man_t<district_t>(aDistrictDesc) {}
81 
83 
84  // --- access specific tuples --- //
85  w_rc_t dist_index_probe(ss_m* db,
86  district_tuple* ptuple,
87  const int w_id,
88  const int d_id);
89 
90  w_rc_t dist_index_probe_forupdate(ss_m* db,
91  district_tuple* ptuple,
92  const int w_id,
93  const int d_id);
94 
95  // --- update a retrieved tuple --- //
96  w_rc_t dist_update_ytd(ss_m* db,
97  district_tuple* ptuple,
98  const double h_amount);
99 
100  w_rc_t dist_update_next_o_id(ss_m* db,
101  district_tuple* ptuple,
102  const int next_o_id);
103  }; // EOF: district_man_impl
104 
105 
106 
107  class customer_man_impl : public table_man_t<customer_t> {
109 
111 
113 
114  public:
115 
116  customer_man_impl(customer_t* aCustomerDesc)
117  : table_man_t<customer_t>(aCustomerDesc) {}
118 
120 
121  // --- access tuples with iterator --- //
122  w_rc_t cust_get_iter_by_index(ss_m* db,
123  customer_index_iter*& iter,
124  customer_tuple* ptuple,
125  rep_row_t& replow,
126  rep_row_t& rephigh,
127  const int w_id,
128  const int d_id,
129  const char* c_last,
130  bool need_tuple = false);
131 
132  // --- access specific tuples --- //
133  w_rc_t cust_index_probe(ss_m* db,
134  customer_tuple* ptuple,
135  const int w_id,
136  const int d_id,
137  const int c_id);
138 
139  w_rc_t cust_index_probe_by_name(ss_m* db,
140  const char* idx_name,
141  customer_tuple* ptuple,
142  const int w_id,
143  const int d_id,
144  const int c_id);
145 
146  w_rc_t cust_index_probe_forupdate(ss_m* db,
147  customer_tuple* ptuple,
148  const int w_id,
149  const int d_id,
150  const int c_id);
151 
152  // --- update a retrieved tuple --- //
153  w_rc_t cust_update_tuple(ss_m* db,
154  customer_tuple* ptuple,
155  const tpcc_customer_tuple& acustomer,
156  const char* adata1 = nullptr,
157  const char* adata2 = nullptr);
158 
159  w_rc_t cust_update_discount_balance(ss_m* db,
160  customer_tuple* ptuple,
161  const decimal discount,
162  const decimal balance);
163  }; // EOF: customer_man_impl
164 
165 
166 
167 
168  class history_man_impl : public table_man_t<history_t> {
170 
171  public:
172 
173  history_man_impl(history_t* aHistoryDesc)
174  : table_man_t<history_t>(aHistoryDesc) {}
175 
177  }; // EOF: history_man_impl
178 
179 
180  class new_order_man_impl : public table_man_t<new_order_t> {
182 
184 
185  public:
186 
187  new_order_man_impl(new_order_t* aNewOrderDesc)
188  : table_man_t<new_order_t>(aNewOrderDesc) {}
189 
191 
192  // --- access tuples with iterator --- //
193  w_rc_t no_get_iter_by_index(ss_m* db,
194  new_order_table_iter*& iter,
195  new_order_tuple* ptuple,
196  rep_row_t& replow,
197  rep_row_t& rephigh,
198  const int w_id,
199  const int d_id,
200  bool need_tuple = false);
201 
202  // --- update a retrieved tuple --- //
203  w_rc_t no_delete_by_index(ss_m* db,
204  new_order_tuple* ptuple,
205  const int w_id,
206  const int d_id,
207  const int o_id);
208  }; // EOF: new_order_man_impl
209 
210 
211  class order_man_impl : public table_man_t<order_t> {
213 
215 
217 
218  public:
219 
220  order_man_impl(order_t* aOrderDesc)
221  : table_man_t<order_t>(aOrderDesc) {}
222 
224 
225  // --- access tuples with iterator --- //
226  w_rc_t ord_get_iter_by_index(ss_m* db,
227  order_index_iter*& iter,
228  order_tuple* ptuple,
229  rep_row_t& replow,
230  rep_row_t& rephigh,
231  const int w_id,
232  const int d_id,
233  const int c_id,
234  bool need_tuple = true);
235 
236  // --- update a retrieved tuple --- //
237  w_rc_t ord_update_carrier_by_index(ss_m* db,
238  order_tuple* ptuple,
239  const int carrier_id);
240  }; // EOF: order_man_impl
241 
242 
243 
244  class order_line_man_impl : public table_man_t<order_line_t> {
246 
248 
249  public:
250 
251  order_line_man_impl(order_line_t* aOrderLineDesc)
252  : table_man_t<order_line_t>(aOrderLineDesc) {}
253 
255 
256  // --- access tuple with iterator --- //
257  w_rc_t ol_get_range_iter_by_index(ss_m* db,
258  order_line_table_iter*& iter,
259  order_line_tuple* ptuple,
260  rep_row_t& replow,
261  rep_row_t& rephigh,
262  const int w_id,
263  const int d_id,
264  const int low_o_id,
265  const int high_o_id,
266  bool need_tuple = true);
267 
268  w_rc_t ol_get_probe_iter_by_index(ss_m* db,
269  order_line_table_iter*& iter,
270  order_line_tuple* ptuple,
271  rep_row_t& replow,
272  rep_row_t& rephigh,
273  const int w_id,
274  const int d_id,
275  const int o_id,
276  bool need_tuple = true);
277  }; // EOF: order_line_man_impl
278 
279 
280 
281  class item_man_impl : public table_man_t<item_t> {
283 
285 
286  public:
287 
288  item_man_impl(item_t* aItemDesc)
289  : table_man_t<item_t>(aItemDesc) {}
290 
292 
293  // --- access specific tuple --- //
294  w_rc_t it_index_probe(ss_m* ddb,
295  item_tuple* ptuple,
296  const int i_id);
297 
298  w_rc_t it_index_probe_forupdate(ss_m* db,
299  item_tuple* ptuple,
300  const int i_id);
301  }; // EOF: item_man_impl
302 
303 
304 
305  class stock_man_impl : public table_man_t<stock_t> {
307 
309 
310  public:
311 
312  stock_man_impl(stock_t* aStockDesc)
313  : table_man_t<stock_t>(aStockDesc) {}
314 
316 
317  /* --- access the table --- */
318  w_rc_t st_index_probe(ss_m* db,
319  stock_tuple* ptuple,
320  const int w_id,
321  const int i_id);
322 
323  w_rc_t st_index_probe_forupdate(ss_m* db,
324  stock_tuple* ptuple,
325  const int w_id,
326  const int i_id);
327 
328  /* --- update a retrieved tuple --- */
329  w_rc_t st_update_tuple(ss_m* db,
330  stock_tuple* ptuple,
331  const tpcc_stock_tuple* pstock);
332  }; // EOF: stock_man_impl
333 
334 };
335 
336 #endif // __TPCC_SCHEMA_MAN_H
item_man_impl(item_t *aItemDesc)
Definition: tpcc_schema_man.h:288
~stock_man_impl()
Definition: tpcc_schema_man.h:315
history_man_impl(history_t *aHistoryDesc)
Definition: tpcc_schema_man.h:173
index_scan_iter_impl< customer_t > customer_index_iter
Definition: tpcc_schema_man.h:112
warehouse_man_impl(warehouse_t *aWarehouseDesc)
Definition: tpcc_schema_man.h:51
table_row_t new_order_tuple
Definition: tpcc_schema_man.h:181
~district_man_impl()
Definition: tpcc_schema_man.h:82
index_scan_iter_impl< order_t > order_index_iter
Definition: tpcc_schema_man.h:216
~order_line_man_impl()
Definition: tpcc_schema_man.h:254
w_rc_t wh_update_ytd(ss_m *db, warehouse_tuple *ptuple, const double h_amount)
Definition: tpcc_schema_man.cpp:68
Definition: decimal.h:32
table_scan_iter_impl< stock_t > stock_table_iter
Definition: tpcc_schema_man.h:308
Definition: tpcc_schema_man.h:74
w_rc_t wh_index_probe_forupdate(ss_m *db, warehouse_tuple *ptuple, const int w_id)
Definition: tpcc_schema_man.cpp:59
Definition: scan.h:61
table_row_t district_tuple
Definition: tpcc_schema_man.h:75
table_scan_iter_impl< item_t > item_table_iter
Definition: tpcc_schema_man.h:284
: Declaration of the TPC-C tables
order_line_man_impl(order_line_t *aOrderLineDesc)
Definition: tpcc_schema_man.h:251
~new_order_man_impl()
Definition: tpcc_schema_man.h:190
Definition: tpcc_schema_man.h:107
Definition: scan.h:94
new_order_man_impl(new_order_t *aNewOrderDesc)
Definition: tpcc_schema_man.h:187
Definition: tpcc_schema_man.h:180
stock_man_impl(stock_t *aStockDesc)
Definition: tpcc_schema_man.h:312
Definition: tpcc_schema_man.h:46
Definition: tpcc_client.cpp:33
~order_man_impl()
Definition: tpcc_schema_man.h:223
table_row_t item_tuple
Definition: tpcc_schema_man.h:282
Definition: tpcc_struct.h:54
This is the SHORE Storage Manager API.
Definition: sm.h:405
~history_man_impl()
Definition: tpcc_schema_man.h:176
Definition: tpcc_schema_man.h:305
table_row_t stock_tuple
Definition: tpcc_schema_man.h:306
Definition: tpcc_schema_man.h:211
district_man_impl(district_t *aDistrictDesc)
Definition: tpcc_schema_man.h:79
customer_man_impl(customer_t *aCustomerDesc)
Definition: tpcc_schema_man.h:116
w_rc_t wh_index_probe(ss_m *db, warehouse_tuple *ptuple, const int w_id)
Definition: tpcc_schema_man.cpp:50
Data structures for the TPC-C database.
order_man_impl(order_t *aOrderDesc)
Definition: tpcc_schema_man.h:220
Return code for most functions and methods.
Definition: w_rc.h:87
table_row_t warehouse_tuple
Definition: tpcc_schema_man.h:47
table_scan_iter_impl< customer_t > customer_table_iter
Definition: tpcc_schema_man.h:110
~customer_man_impl()
Definition: tpcc_schema_man.h:119
Definition: tpcc_schema_man.h:168
Definition: row.h:117
~item_man_impl()
Definition: tpcc_schema_man.h:291
Definition: tpcc_schema_man.h:244
volatile unsigned long balance
Definition: tpcb_input.cpp:133
table_scan_iter_impl< order_t > order_table_iter
Definition: tpcc_schema_man.h:214
~warehouse_man_impl()
Definition: tpcc_schema_man.h:54
table_row_t order_line_tuple
Definition: tpcc_schema_man.h:245
table_scan_iter_impl< new_order_t > new_order_table_iter
Definition: tpcc_schema_man.h:183
table_row_t customer_tuple
Definition: tpcc_schema_man.h:108
Definition: tpcc_schema_man.h:281
table_scan_iter_impl< order_line_t > order_line_table_iter
Definition: tpcc_schema_man.h:247
Definition: tpcc_struct.h:326
Definition: row.h:147
table_row_t order_tuple
Definition: tpcc_schema_man.h:212
table_row_t history_tuple
Definition: tpcc_schema_man.h:169
Definition: table_man.h:117