1 | /* |
2 | Copyright (c) 2012,2013 Monty Program Ab |
3 | |
4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by |
6 | the Free Software Foundation; version 2 of the License. |
7 | |
8 | This program is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | GNU General Public License for more details. |
12 | |
13 | You should have received a copy of the GNU General Public License |
14 | along with this program; if not, write to the Free Software |
15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
16 | #pragma once |
17 | |
18 | /* C++ standard header files */ |
19 | #include <string> |
20 | #include <vector> |
21 | |
22 | /* MySQL header files */ |
23 | #include "./sql_string.h" |
24 | |
25 | /* RocksDB includes */ |
26 | #include "rocksdb/table.h" |
27 | #include "rocksdb/utilities/transaction_db.h" |
28 | |
29 | namespace myrocks { |
30 | |
31 | enum RDB_IO_ERROR_TYPE { |
32 | RDB_IO_ERROR_TX_COMMIT, |
33 | RDB_IO_ERROR_DICT_COMMIT, |
34 | RDB_IO_ERROR_BG_THREAD, |
35 | RDB_IO_ERROR_GENERAL, |
36 | RDB_IO_ERROR_LAST |
37 | }; |
38 | |
39 | const char *get_rdb_io_error_string(const RDB_IO_ERROR_TYPE err_type); |
40 | |
41 | void rdb_handle_io_error(const rocksdb::Status status, |
42 | const RDB_IO_ERROR_TYPE err_type); |
43 | |
44 | int rdb_normalize_tablename(const std::string &tablename, std::string *str) |
45 | MY_ATTRIBUTE((__nonnull__, __warn_unused_result__)); |
46 | |
47 | int rdb_split_normalized_tablename(const std::string &fullname, std::string *db, |
48 | std::string *table = nullptr, |
49 | std::string *partition = nullptr) |
50 | MY_ATTRIBUTE((__warn_unused_result__)); |
51 | |
52 | std::vector<std::string> rdb_get_open_table_names(void); |
53 | |
54 | class Rdb_perf_counters; |
55 | int rdb_get_table_perf_counters(const char *tablename, |
56 | Rdb_perf_counters *counters) |
57 | MY_ATTRIBUTE((__nonnull__(2))); |
58 | |
59 | void rdb_get_global_perf_counters(Rdb_perf_counters *counters) |
60 | MY_ATTRIBUTE((__nonnull__(1))); |
61 | |
62 | void rdb_queue_save_stats_request(); |
63 | |
64 | /* |
65 | Access to singleton objects. |
66 | */ |
67 | |
68 | rocksdb::TransactionDB *rdb_get_rocksdb_db(); |
69 | |
70 | class Rdb_cf_manager; |
71 | Rdb_cf_manager &rdb_get_cf_manager(); |
72 | |
73 | const rocksdb::BlockBasedTableOptions &rdb_get_table_options(); |
74 | bool rdb_is_ttl_enabled(); |
75 | bool rdb_is_ttl_read_filtering_enabled(); |
76 | #ifndef NDEBUG |
77 | int rdb_dbug_set_ttl_rec_ts(); |
78 | int rdb_dbug_set_ttl_snapshot_ts(); |
79 | int rdb_dbug_set_ttl_read_filter_ts(); |
80 | bool rdb_dbug_set_ttl_ignore_pk(); |
81 | #endif |
82 | |
83 | enum operation_type : int; |
84 | void rdb_update_global_stats(const operation_type &type, uint count, |
85 | bool is_system_table = false); |
86 | |
87 | class Rdb_dict_manager; |
88 | Rdb_dict_manager *rdb_get_dict_manager(void) |
89 | MY_ATTRIBUTE((__warn_unused_result__)); |
90 | |
91 | class Rdb_ddl_manager; |
92 | Rdb_ddl_manager *rdb_get_ddl_manager(void) |
93 | MY_ATTRIBUTE((__warn_unused_result__)); |
94 | |
95 | class Rdb_binlog_manager; |
96 | Rdb_binlog_manager *rdb_get_binlog_manager(void) |
97 | MY_ATTRIBUTE((__warn_unused_result__)); |
98 | } // namespace myrocks |
99 | |