aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/lmdb/db_lmdb.h
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2016-01-07 06:33:22 +0000
committerHoward Chu <hyc@symas.com>2016-02-17 04:05:29 +0000
commit090b548c3b5a5cd59b67fa7a7bb4f0cf50b193e1 (patch)
tree6dd01a087c1054f11039c668a2b82e2ff83a5182 /src/blockchain_db/lmdb/db_lmdb.h
parentKeep a running blocksize count (diff)
downloadmonero-090b548c3b5a5cd59b67fa7a7bb4f0cf50b193e1.tar.xz
Use cursors in write txns
Saves a bit of seek overhead. LMDB frees them automatically in txn_(commit|abort) so they need no cleanup.
Diffstat (limited to 'src/blockchain_db/lmdb/db_lmdb.h')
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.h b/src/blockchain_db/lmdb/db_lmdb.h
index 1964bfe45..150f59475 100644
--- a/src/blockchain_db/lmdb/db_lmdb.h
+++ b/src/blockchain_db/lmdb/db_lmdb.h
@@ -38,6 +38,46 @@
namespace cryptonote
{
+struct mdb_txn_cursors
+{
+ MDB_cursor *m_txc_blocks;
+ MDB_cursor *m_txc_block_heights;
+ MDB_cursor *m_txc_block_hashes;
+ MDB_cursor *m_txc_block_timestamps;
+ MDB_cursor *m_txc_block_sizes;
+ MDB_cursor *m_txc_block_diffs;
+ MDB_cursor *m_txc_block_coins;
+
+ MDB_cursor *m_txc_output_txs;
+ MDB_cursor *m_txc_output_indices;
+ MDB_cursor *m_txc_output_amounts;
+ MDB_cursor *m_txc_output_keys;
+
+ MDB_cursor *m_txc_txs;
+ MDB_cursor *m_txc_tx_heights;
+ MDB_cursor *m_txc_tx_unlocks;
+ MDB_cursor *m_txc_tx_outputs;
+
+ MDB_cursor *m_txc_spent_keys;
+};
+
+#define m_cur_blocks m_cursors.m_txc_blocks
+#define m_cur_block_heights m_cursors.m_txc_block_heights
+#define m_cur_block_hashes m_cursors.m_txc_block_hashes
+#define m_cur_block_timestamps m_cursors.m_txc_block_timestamps
+#define m_cur_block_sizes m_cursors.m_txc_block_sizes
+#define m_cur_block_diffs m_cursors.m_txc_block_diffs
+#define m_cur_block_coins m_cursors.m_txc_block_coins
+#define m_cur_output_txs m_cursors.m_txc_output_txs
+#define m_cur_output_indices m_cursors.m_txc_output_indices
+#define m_cur_output_amounts m_cursors.m_txc_output_amounts
+#define m_cur_output_keys m_cursors.m_txc_output_keys
+#define m_cur_txs m_cursors.m_txc_txs
+#define m_cur_tx_heights m_cursors.m_txc_tx_heights
+#define m_cur_tx_unlocks m_cursors.m_txc_tx_unlocks
+#define m_cur_tx_outputs m_cursors.m_txc_tx_outputs
+#define m_cur_spent_keys m_cursors.m_txc_spent_keys
+
struct mdb_txn_safe
{
mdb_txn_safe();
@@ -315,6 +355,8 @@ private:
bool m_batch_transactions; // support for batch transactions
bool m_batch_active; // whether batch transaction is in progress
+ struct mdb_txn_cursors m_cursors;
+
#if defined(__arm__)
// force a value so it can compile with 32-bit ARM
constexpr static uint64_t DEFAULT_MAPSIZE = 1LL << 31;