2
-*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
5
* Definitions required for Configuration Variables plugin
7
* Copyright (C) 2008 Mark Atwood
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 2 of the License.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#ifndef DRIZZLED_PLUGIN_REPLICATOR_H
24
#define DRIZZLED_PLUGIN_REPLICATOR_H
29
* Defines the API for Replication
33
* Base class for replication implementations.
35
* if a method returns bool true, that means it failed.
42
virtual bool session_init_hook(Session *) { return false; }
43
virtual bool row_insert_hook(Session *, Table *) { return false; }
44
virtual bool row_update_hook(Session *, Table *,
45
const unsigned char *,
46
const unsigned char *) { return false; }
47
virtual bool row_delete_hook(Session *, Table *) { return false; }
48
virtual bool end_transaction_hook(Session *, bool, bool) { return false; }
49
virtual bool statement_hook(Session *, const char *, size_t) { return false; }
52
Replicator() : enabled(true) {}
54
virtual ~Replicator() {}
56
* Initialize session for replication
58
bool session_init(Session *session)
60
return session_init_hook(session);
66
* @param current Session
67
* @param Table inserted
69
bool row_insert(Session *session, Table *table)
71
return row_insert_hook(session, table);
77
* @param current Session
78
* @param Table updated
79
* @param before values
82
bool row_update(Session *session, Table *table,
83
const unsigned char *before,
84
const unsigned char *after)
86
return row_update_hook(session, table, before, after);
92
* @param current session
93
* @param Table deleted from
95
bool row_delete(Session *session, Table *table)
97
return row_delete_hook(session, table);
103
* @param current Session
104
* @param is autocommit on?
105
* @param did the transaction commit?
107
bool end_transaction(Session *session, bool autocommit, bool commit)
109
return end_transaction_hook(session, autocommit, commit);
115
* @param current Session
116
* @param query string
117
* @param length of query string in bytes
119
bool statement(Session *session, const char *query, size_t query_length)
121
return statement_hook(session, query, query_length);
125
#endif /* DRIZZLED_PLUGIN_REPLICATOR_H */