1 /*
2  * Copyright (C) 2018 Codership Oy <info@codership.com>
3  *
4  * This file is part of wsrep-lib.
5  *
6  * Wsrep-lib is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * Wsrep-lib is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with wsrep-lib.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef WSREP_DB_CLIENT_SERVICE_HPP
21 #define WSREP_DB_CLIENT_SERVICE_HPP
22 
23 #include "wsrep/client_service.hpp"
24 #include "wsrep/transaction.hpp"
25 
26 namespace db
27 {
28     class client;
29     class client_state;
30 
31     class client_service : public wsrep::client_service
32     {
33     public:
34         client_service(db::client& client);
35 
interrupted(wsrep::unique_lock<wsrep::mutex> &) const36         bool interrupted(wsrep::unique_lock<wsrep::mutex>&)
37             const override
38         { return false; }
reset_globals()39         void reset_globals() override { }
store_globals()40         void store_globals() override { }
prepare_data_for_replication()41         int prepare_data_for_replication() override
42         {
43             return 0;
44         }
cleanup_transaction()45         void cleanup_transaction() override { }
bytes_generated() const46         size_t bytes_generated() const override
47         {
48             return 0;
49         }
statement_allowed_for_streaming() const50         bool statement_allowed_for_streaming() const override
51         {
52             return true;
53         }
prepare_fragment_for_replication(wsrep::mutable_buffer &,size_t & position)54         int prepare_fragment_for_replication(wsrep::mutable_buffer&,
55                                              size_t& position) override
56         {
57             position = 0;
58             return 0;
59         }
remove_fragments()60         int remove_fragments() override { return 0; }
61         int bf_rollback() override;
will_replay()62         void will_replay() override { }
signal_replayed()63         void signal_replayed() override { }
wait_for_replayers(wsrep::unique_lock<wsrep::mutex> &)64         void wait_for_replayers(wsrep::unique_lock<wsrep::mutex>&) override { }
65         enum wsrep::provider::status replay()
66             override;
67 
replay_unordered()68         enum wsrep::provider::status replay_unordered() override
69         {
70             return wsrep::provider::success;
71         }
72 
emergency_shutdown()73         void emergency_shutdown() override { ::abort(); }
74 
commit_by_xid()75         enum wsrep::provider::status commit_by_xid() override
76         {
77             return wsrep::provider::success;
78         }
79 
is_explicit_xa()80         bool is_explicit_xa() override
81         {
82             return false;
83         }
84 
is_xa_rollback()85         bool is_xa_rollback() override
86         {
87             return false;
88         }
89 
debug_sync(const char *)90         void debug_sync(const char*) override { }
debug_crash(const char *)91         void debug_crash(const char*) override { }
92     private:
93         db::client& client_;
94         wsrep::client_state& client_state_;
95     };
96 }
97 
98 #endif // WSREP_DB_CLIENT_SERVICE_HPP
99