20
20
#ifndef DRIZZLED_REPLICATOR_H
21
21
#define DRIZZLED_REPLICATOR_H
23
#include <drizzled/plugin/replicator.h>
25
int replicator_initializer (st_plugin_int *plugin);
26
int replicator_finalizer (st_plugin_int *plugin);
26
/* some forward declarations needed */
43
void add_replicator(drizzled::plugin::Replicator *repl);
44
void remove_replicator(drizzled::plugin::Replicator *repl);
47
* This is a class which manages transforming internal
48
* transactional events into GPB messages and sending those
49
* events out through registered replicators and appliers.
53
class TransactionServices
56
/** Our collection of replicator plugins */
57
std::vector<drizzled::plugin::Replicator *> replicators;
58
/** Our collection of applier plugins */
59
std::vector<drizzled::plugin::Applier *> appliers;
61
* Helper method which attaches a transaction context
62
* the supplied command based on the supplied Session's
63
* transaction information.
65
void setCommandTransactionContext(drizzled::message::Command *in_command, Session *in_session) const;
67
* Helper method which pushes a constructed message out
68
* to the registered replicator and applier plugins.
70
* @param Message to push out
72
void push(drizzled::message::Command *to_push);
75
* Attaches a replicator to our internal collection of
78
* @param Pointer to a replicator to attach/register
80
void attachReplicator(drizzled::plugin::Replicator *in_replicator);
82
* Detaches/unregisters a replicator with our internal
83
* collection of replicators.
85
* @param Pointer to the replicator to detach
87
void detachReplicator(drizzled::plugin::Replicator *in_replicator);
89
* Attaches a applier to our internal collection of
92
* @param Pointer to a applier to attach/register
94
void attachApplier(drizzled::plugin::Applier *in_applier);
96
* Detaches/unregisters a applier with our internal
97
* collection of appliers.
99
* @param Pointer to the applier to detach
101
void detachApplier(drizzled::plugin::Applier *in_applier);
103
* Creates a new StartTransaction GPB message and pushes
106
* @param Pointer to the Session starting the transaction
108
void startTransaction(Session *in_session);
110
* Creates a new CommitTransaction GPB message and pushes
113
* @param Pointer to the Session committing the transaction
115
void commitTransaction(Session *in_session);
117
* Creates a new RollbackTransaction GPB message and pushes
120
* @param Pointer to the Session committing the transaction
122
void rollbackTransaction(Session *in_session);
124
* Creates a new InsertRecord GPB message and pushes it to
127
* @param Pointer to the Session which has inserted a record
128
* @param Pointer to the Table containing insert information
130
void insertRecord(Session *in_session, Table *in_table);
132
* Creates a new UpdateRecord GPB message and pushes it to
135
* @param Pointer to the Session which has updated a record
136
* @param Pointer to the Table containing update information
138
void updateRecord(Session *in_session, Table *in_table, const unsigned char *, const unsigned char *);
140
* Creates a new DeleteRecord GPB message and pushes it to
143
* @param Pointer to the Session which has deleted a record
144
* @param Pointer to the Table containing delete information
146
void deleteRecord(Session *in_session, Table *in_table);
148
* Creates a new RawSql GPB message and pushes it to
151
* @TODO With a real data dictionary, this really shouldn't
152
* be needed. CREATE TABLE would map to insertRecord call
153
* on the I_S, etc. Not sure what to do with administrative
154
* commands like CHECK TABLE, though..
156
* @param Pointer to the Session which issued the statement
157
* @param Query string
158
* @param Length of the query string
160
void rawStatement(Session *in_session, const char *in_query, size_t in_query_len);
163
} /* end namespace drizzled */
28
166
/* todo, fill in this API */
29
167
/* these are the functions called by the rest of the drizzle server
30
168
to do whatever this plugin does. */