-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtpccgenerator.h
More file actions
69 lines (48 loc) · 2.19 KB
/
tpccgenerator.h
File metadata and controls
69 lines (48 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef TPCCGENERATOR_H__
#define TPCCGENERATOR_H__
//~ #include <cstdint>
#include <stdint.h>
#include "tpccdb.h"
namespace tpcc {
class RandomGenerator;
}
class TPCCTables;
class TPCCGenerator {
public:
// Owns generator
TPCCGenerator(tpcc::RandomGenerator* random, const char* now, int num_items,
int districts_per_warehouse, int customers_per_district, int new_orders_per_district);
~TPCCGenerator();
// Fills item with random data according to the TPC-C specification 4.3.3.1.
void generateItem(int32_t id, bool original, Item* item);
// Generates num_items items and inserts them into tables.
void makeItemsTable(TPCCTables* tables);
// Fills warehouse with random data according to the TPC-C specification 4.3.3.1.
void generateWarehouse(int32_t id, Warehouse* warehouse);
// Fills stock with random data according to the TPC-C specification 4.3.3.1.
void generateStock(int32_t id, int32_t w_id, bool original, Stock* stock);
// Fills district with random data according to the TPC-C specification 4.3.3.1.
void generateDistrict(int32_t id, int32_t w_id, District* district);
void generateCustomer(int32_t id, int32_t d_id, int32_t w_id, bool bad_credit,
Customer* customer);
void generateOrder(int32_t id, int32_t c_id, int32_t d_id, int32_t w_id, bool new_order,
Order* order);
void generateOrderLine(int32_t number, int32_t o_id, int32_t d_id, int32_t w_id, bool new_order,
OrderLine* orderline);
void generateHistory(int32_t c_id, int32_t d_id, int32_t w_id, History* history);
// Generates stock rows for w_id.
void makeStock(TPCCTables* tables, int32_t w_id);
// Generates one warehouse and all related rows.
void makeWarehouse(TPCCTables* tables, int32_t w_id);
// Generates one warehouse and related rows, except stock.
// TODO: This exists to support partitioning. Does this make sense?
void makeWarehouseWithoutStock(TPCCTables* tables, int32_t w_id);
private:
tpcc::RandomGenerator* random_;
char now_[DATETIME_SIZE+1];
int num_items_;
int districts_per_warehouse_;
int customers_per_district_;
int new_orders_per_district_;
};
#endif