summaryrefslogtreecommitdiffstats
path: root/wsrep-lib/dbsim/db_client.hpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
commita175314c3e5827eb193872241446f2f8f5c9d33c (patch)
treecd3d60ca99ae00829c52a6ca79150a5b6e62528b /wsrep-lib/dbsim/db_client.hpp
parentInitial commit. (diff)
downloadmariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.tar.xz
mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.zip
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wsrep-lib/dbsim/db_client.hpp')
-rw-r--r--wsrep-lib/dbsim/db_client.hpp89
1 files changed, 89 insertions, 0 deletions
diff --git a/wsrep-lib/dbsim/db_client.hpp b/wsrep-lib/dbsim/db_client.hpp
new file mode 100644
index 00000000..5536a449
--- /dev/null
+++ b/wsrep-lib/dbsim/db_client.hpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2018 Codership Oy <info@codership.com>
+ *
+ * This file is part of wsrep-lib.
+ *
+ * Wsrep-lib is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Wsrep-lib is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wsrep-lib. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/** @file db_client.hpp */
+
+#ifndef WSREP_DB_CLIENT_HPP
+#define WSREP_DB_CLIENT_HPP
+
+#include "db_server_state.hpp"
+#include "db_storage_engine.hpp"
+#include "db_client_state.hpp"
+#include "db_client_service.hpp"
+#include "db_high_priority_service.hpp"
+
+#include <random>
+
+namespace db
+{
+ class server;
+ class client
+ {
+ public:
+ struct stats
+ {
+ long long commits;
+ long long rollbacks;
+ long long replays;
+ stats()
+ : commits(0)
+ , rollbacks(0)
+ , replays(0)
+ { }
+ };
+ client(db::server&,
+ wsrep::client_id,
+ enum wsrep::client_state::mode,
+ const db::params&);
+ bool bf_abort(wsrep::seqno);
+ const struct stats stats() const { return stats_; }
+ void store_globals()
+ {
+ client_state_.store_globals();
+ }
+ void reset_globals()
+ { }
+ void start();
+ wsrep::client_state& client_state() { return client_state_; }
+ wsrep::client_service& client_service() { return client_service_; }
+ bool do_2pc() const { return false; }
+ private:
+ friend class db::server_state;
+ friend class db::client_service;
+ friend class db::high_priority_service;
+ template <class F> int client_command(F f);
+ void run_one_transaction();
+ void reset_error();
+ void report_progress(size_t) const;
+ wsrep::default_mutex mutex_;
+ wsrep::default_condition_variable cond_;
+ const db::params& params_;
+ db::server& server_;
+ db::server_state& server_state_;
+ db::client_state client_state_;
+ db::client_service client_service_;
+ db::storage_engine::transaction se_trx_;
+ wsrep::mutable_buffer data_;
+ std::random_device random_device_;
+ std::default_random_engine random_engine_;
+ struct stats stats_;
+ };
+}
+
+#endif // WSREP_DB_CLIENT_HPP