23 #include "sql_plugin.h"
24 #include "replication.h"
33 :observer(ob), plugin_int(p)
35 plugin= plugin_int_to_ref(plugin_int);
52 while (info && info->observer != observer)
57 if (!info || observer_info_list.push_back(info, &memroot))
74 while (info && info->observer != observer)
92 inline bool is_empty()
94 DBUG_PRINT(
"debug", (
"is_empty: %d", observer_info_list.is_empty()));
95 return observer_info_list.is_empty();
98 inline int read_lock()
102 return rw_rdlock(&lock);
105 inline int write_lock()
109 return rw_wrlock(&lock);
116 return rw_unlock(&lock);
119 inline bool is_inited()
127 if (my_rwlock_init(&lock, NULL))
129 init_sql_alloc(&memroot, 1024, 0);
135 rwlock_destroy(&lock);
136 free_root(&memroot, MYF(0));
150 int before_commit(THD *thd,
bool all);
151 int before_rollback(THD *thd,
bool all);
152 int after_commit(THD *thd,
bool all);
153 int after_rollback(THD *thd,
bool all);
160 int after_flush(THD *thd,
const char *log_file,
164 #ifdef HAVE_REPLICATION
165 class Binlog_transmit_delegate
169 int transmit_start(THD *thd, ushort
flags,
170 const char *log_file, my_off_t log_pos);
171 int transmit_stop(THD *thd, ushort
flags);
172 int reserve_header(THD *thd, ushort
flags,
String *packet);
173 int before_send_event(THD *thd, ushort
flags,
175 char *log_file, my_off_t log_pos );
176 int after_send_event(THD *thd, ushort
flags,
177 String *packet,
const char *skipped_log_file,
178 my_off_t skipped_log_pos);
179 int after_reset_master(THD *thd, ushort
flags);
182 class Binlog_relay_IO_delegate
186 int thread_start(THD *thd, Master_info *mi);
187 int thread_stop(THD *thd, Master_info *mi);
188 int before_request_transmit(THD *thd, Master_info *mi, ushort
flags);
189 int after_read_event(THD *thd, Master_info *mi,
190 const char *packet, ulong len,
191 const char **event_buf, ulong *event_len);
192 int after_queue_event(THD *thd, Master_info *mi,
193 const char *event_buf, ulong event_len,
195 int after_reset_slave(THD *thd, Master_info *mi);
201 int delegates_init();
202 void delegates_destroy();
206 #ifdef HAVE_REPLICATION
207 extern Binlog_transmit_delegate *binlog_transmit_delegate;
208 extern Binlog_relay_IO_delegate *binlog_relay_io_delegate;
215 #define RUN_HOOK(group, hook, args) \
216 (group ##_delegate->is_empty() ? \
217 0 : group ##_delegate->hook args)