CCF
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions
tpcc_tables.h File Reference
#include "ccf/ds/json.h"
#include "ccf/ds/nonstd.h"
#include "ccf/kv/map.h"
#include "ccf/kv/serialisers/serialised_entry.h"
#include "ds/serialized.h"
#include "tpcc_common.h"
#include <cstring>
#include <nlohmann/json.hpp>
#include <stdint.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

Go to the source code of this file.

Classes

struct  tpcc::TpccSerialiser< T >
 
struct  tpcc::Item
 
struct  tpcc::Item::Key
 
struct  tpcc::Warehouse
 
struct  tpcc::Warehouse::Key
 
struct  tpcc::District
 
struct  tpcc::District::Key
 
struct  tpcc::Stock
 
struct  tpcc::Stock::Key
 
struct  tpcc::Customer
 
struct  tpcc::Customer::Key
 
struct  tpcc::Order
 
struct  tpcc::Order::Key
 
struct  tpcc::OrderLine
 
struct  tpcc::OrderLine::Key
 
struct  tpcc::NewOrder
 
struct  tpcc::NewOrder::Key
 
struct  tpcc::History
 
struct  tpcc::History::Key
 
struct  tpcc::TpccTables
 
union  tpcc::TpccTables::DistributeKey
 

Namespaces

namespace  tpcc
 
namespace  tpcc::Address
 

Macros

#define ADD_SERIALIZED_SIZE_FOR_JSON_NEXT(TYPE, FIELD)    +serialised_size<decltype(TYPE::FIELD)>()
 
#define ADD_SERIALIZED_SIZE_FOR_JSON_FINAL(TYPE, FIELD)    ADD_SERIALIZED_SIZE_FOR_JSON_NEXT(TYPE, FIELD)
 
#define WRITE_VALUE_FOR_JSON_NEXT(TYPE, FIELD)   write_value(t.FIELD, data, size);
 
#define WRITE_VALUE_FOR_JSON_FINAL(TYPE, FIELD)    WRITE_VALUE_FOR_JSON_NEXT(TYPE, FIELD)
 
#define READ_VALUE_FOR_JSON_NEXT(TYPE, FIELD)   read_value(t.FIELD, data, size);
 
#define READ_VALUE_FOR_JSON_FINAL(TYPE, FIELD)    READ_VALUE_FOR_JSON_NEXT(TYPE, FIELD)
 
#define DECLARE_TPCC_TYPE(TYPE)
 
#define DECLARE_TPCC_REQUIRED_FIELDS(TYPE, ...)
 

Typedefs

template<typename K , typename V >
using tpcc::TpccMap = ccf::kv::MapSerialisedWith< K, V, TpccSerialiser >
 

Functions

template<typename T >
ccf::kv::serialisers::SerialisedEntry tpcc::tpcc_serialise (const T &t)
 
template<typename T >
tpcc::tpcc_deserialise (const ccf::kv::serialisers::SerialisedEntry &rep)
 
template<typename T >
constexpr size_t tpcc::serialised_size ()
 
template<typename T >
void tpcc::write_value (const T &v, uint8_t *&data, size_t &size)
 
template<typename T >
void tpcc::read_value (T &v, const uint8_t *&data, size_t &size)
 
 tpcc::DECLARE_TPCC_TYPE (Item::Key)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Item::Key, id)
 
 tpcc::DECLARE_TPCC_TYPE (Item)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Item, id, im_id, price, name, data)
 
 tpcc::DECLARE_TPCC_TYPE (Warehouse::Key)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Warehouse::Key, id)
 
 tpcc::DECLARE_TPCC_TYPE (Warehouse)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Warehouse, id, tax, ytd, name, street_1, street_2, city, state, zip)
 
 tpcc::DECLARE_TPCC_TYPE (District::Key)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (District::Key, id, w_id)
 
 tpcc::DECLARE_TPCC_TYPE (District)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (District, id, w_id, tax, ytd, next_o_id, name, street_1, street_2, city, state, zip)
 
 tpcc::DECLARE_TPCC_TYPE (Stock::Key)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Stock::Key, i_id, w_id)
 
 tpcc::DECLARE_TPCC_TYPE (Stock)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Stock, i_id, w_id, quantity, ytd, order_cnt, remote_cnt, dist, data)
 
 tpcc::DECLARE_TPCC_TYPE (Customer::Key)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Customer::Key, id)
 
 tpcc::DECLARE_TPCC_TYPE (Customer)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Customer, id, d_id, w_id, credit_lim, discount, balance, ytd_payment, payment_cnt, delivery_cnt, first, middle, last, street_1, street_2, city, state, zip, phone, since, credit, data)
 
 tpcc::DECLARE_TPCC_TYPE (Order::Key)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Order::Key, id)
 
 tpcc::DECLARE_TPCC_TYPE (Order)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (Order, id, c_id, d_id, w_id, carrier_id, ol_cnt, all_local, entry_d)
 
 tpcc::DECLARE_TPCC_TYPE (OrderLine::Key)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (OrderLine::Key, o_id, d_id, w_id, number)
 
 tpcc::DECLARE_TPCC_TYPE (OrderLine)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (OrderLine, o_id, d_id, w_id, number, i_id, supply_w_id, quantity, amount, delivery_d, dist_info)
 
 tpcc::DECLARE_TPCC_TYPE (NewOrder::Key)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (NewOrder::Key, w_id, d_id, o_id)
 
 tpcc::DECLARE_TPCC_TYPE (NewOrder)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (NewOrder, w_id, d_id, o_id)
 
 tpcc::DECLARE_TPCC_TYPE (History::Key)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (History::Key, c_id, c_d_id, c_w_id, d_id, w_id)
 
 tpcc::DECLARE_TPCC_TYPE (History)
 
 tpcc::DECLARE_TPCC_REQUIRED_FIELDS (History, c_id, c_d_id, c_w_id, d_id, w_id, amount, date, data)
 

Macro Definition Documentation

◆ ADD_SERIALIZED_SIZE_FOR_JSON_FINAL

#define ADD_SERIALIZED_SIZE_FOR_JSON_FINAL (   TYPE,
  FIELD 
)     ADD_SERIALIZED_SIZE_FOR_JSON_NEXT(TYPE, FIELD)

◆ ADD_SERIALIZED_SIZE_FOR_JSON_NEXT

#define ADD_SERIALIZED_SIZE_FOR_JSON_NEXT (   TYPE,
  FIELD 
)     +serialised_size<decltype(TYPE::FIELD)>()

◆ DECLARE_TPCC_REQUIRED_FIELDS

#define DECLARE_TPCC_REQUIRED_FIELDS (   TYPE,
  ... 
)
Value:
_Pragma("clang diagnostic push"); \
_Pragma("clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\""); \
template <> \
ccf::kv::serialisers::SerialisedEntry tpcc_serialise(const TYPE& t) \
{ \
constexpr size_t required_size = 0 _FOR_JSON_COUNT_NN(__VA_ARGS__)(POP1)( \
ADD_SERIALIZED_SIZE, TYPE, ##__VA_ARGS__); \
rep.resize(required_size); \
auto data = rep.data(); \
auto size = rep.size(); \
_FOR_JSON_COUNT_NN(__VA_ARGS__)(POP1)(WRITE_VALUE, TYPE, ##__VA_ARGS__); \
return rep; \
} \
template <> \
TYPE tpcc_deserialise(const ccf::kv::serialisers::SerialisedEntry& rep) \
{ \
auto data = rep.data(); \
auto size = rep.size(); \
TYPE t; \
_FOR_JSON_COUNT_NN(__VA_ARGS__)(POP1)(READ_VALUE, TYPE, ##__VA_ARGS__); \
return t; \
} \
_Pragma("clang diagnostic pop");
#define _FOR_JSON_COUNT_NN(...)
Definition json.h:201
ccf::ByteVector SerialisedEntry
Definition serialised_entry.h:8

◆ DECLARE_TPCC_TYPE

#define DECLARE_TPCC_TYPE (   TYPE)

◆ READ_VALUE_FOR_JSON_FINAL

#define READ_VALUE_FOR_JSON_FINAL (   TYPE,
  FIELD 
)     READ_VALUE_FOR_JSON_NEXT(TYPE, FIELD)

◆ READ_VALUE_FOR_JSON_NEXT

#define READ_VALUE_FOR_JSON_NEXT (   TYPE,
  FIELD 
)    read_value(t.FIELD, data, size);

◆ WRITE_VALUE_FOR_JSON_FINAL

#define WRITE_VALUE_FOR_JSON_FINAL (   TYPE,
  FIELD 
)     WRITE_VALUE_FOR_JSON_NEXT(TYPE, FIELD)

◆ WRITE_VALUE_FOR_JSON_NEXT

#define WRITE_VALUE_FOR_JSON_NEXT (   TYPE,
  FIELD 
)    write_value(t.FIELD, data, size);