1 /* Copyright 2018 Codership Oy <info@codership.com>
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; version 2 of the License.
6 
7    This program is distributed in the hope that it will be useful,
8    but WITHOUT ANY WARRANTY; without even the implied warranty of
9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10    GNU General Public License for more details.
11 
12    You should have received a copy of the GNU General Public License
13    along with this program; if not, write to the Free Software
14    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
15 
16 #ifndef WSREP_STORAGE_SERVICE_H
17 #define WSREP_STORAGE_SERVICE_H
18 
19 #include "wsrep/storage_service.hpp"
20 #include "wsrep/client_state.hpp"
21 
22 class THD;
23 class Wsrep_server_service;
24 class Wsrep_storage_service :
25   public wsrep::storage_service,
26   public wsrep::high_priority_context
27 {
28 public:
29   Wsrep_storage_service(THD*);
30   ~Wsrep_storage_service();
31   int start_transaction(const wsrep::ws_handle&);
32   void adopt_transaction(const wsrep::transaction&);
33   int append_fragment(const wsrep::id&,
34                       wsrep::transaction_id,
35                       int flags,
36                       const wsrep::const_buffer&,
37                       const wsrep::xid&);
38   int update_fragment_meta(const wsrep::ws_meta&);
39   int remove_fragments();
40   int commit(const wsrep::ws_handle&, const wsrep::ws_meta&);
41   int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&);
42   void store_globals();
43   void reset_globals();
44 private:
45   friend class Wsrep_server_service;
46   THD* m_thd;
47 };
48 
49 #endif /* WSREP_STORAGE_SERVICE_H */
50