1 #ifndef _ABSTRACT_DB_H_
2 #define _ABSTRACT_DB_H_
11 #include "abstract_ordered_index.h"
16 // dtor should close db
17 virtual ~abstract_db() {}
20 * an approximate max batch size for updates in a transaction.
22 * A return value of -1 indicates no maximum
24 virtual ssize_t txn_max_batch_size() const { return -1; }
27 * XXX(stephentu): hack
29 virtual void do_txn_epoch_sync() const {}
32 * XXX(stephentu): hack
34 virtual void do_txn_finish() const {}
36 /** loader should be used as a performance hint, not for correctness */
37 virtual void thread_init(bool loader) {}
39 virtual void thread_end() {}
41 // [ntxns_persisted, ntxns_committed, avg latency]
42 virtual std::tuple<uint64_t, uint64_t, double>
43 get_ntxn_persisted() const { return std::make_tuple(0, 0, 0.0); }
45 virtual void reset_ntxn_persisted() { }
51 HINT_KV_GET_PUT, // KV workloads over a single key
52 HINT_KV_RMW, // get/put over a single key
53 HINT_KV_SCAN, // KV scan workloads (~100 keys)
59 HINT_TPCC_ORDER_STATUS,
60 HINT_TPCC_ORDER_STATUS_READ_ONLY,
61 HINT_TPCC_STOCK_LEVEL,
62 HINT_TPCC_STOCK_LEVEL_READ_ONLY,
66 // * Initializes a new txn object the space pointed to by buf
68 // * Flags is only for the ndb protocol for now
70 // * [buf, buf + sizeof_txn_object(txn_flags)) is a valid ptr
72 //virtual void *new_txn(uint64_t txn_flags, void *buf,
73 // TxnProfileHint hint = HINT_DEFAULT) = 0;
75 typedef std::map<std::string, uint64_t> counter_map;
76 typedef std::map<std::string, counter_map> txn_counter_map;
79 * Reports things like read/write set sizes
82 get_txn_counters(void *txn) const
88 // * Returns true on successful commit.
90 // * On failure, can either throw abstract_abort_exception, or
91 // * return false- caller should be prepared to deal with both cases
93 //virtual bool commit_txn(void *txn) = 0;
98 //virtual void abort_txn(void *txn) = 0;
100 //virtual void print_txn_debug(void *txn) const {}
102 //virtual abstract_ordered_index *
103 //open_index(const std::string &name,
104 // size_t value_size_hint,
105 // bool mostly_append = false) = 0;
108 //close_index(abstract_ordered_index *idx) = 0;
111 #endif /* _ABSTRACT_DB_H_ */