20
20
#ifndef DRIZZLED_REPLICATOR_H
21
21
#define DRIZZLED_REPLICATOR_H
23
#include <drizzled/plugin/replicator.h>
25
25
int replicator_initializer (st_plugin_int *plugin);
26
26
int replicator_finalizer (st_plugin_int *plugin);
28
/* some forward declarations needed */
46
* This is a class which manages transforming internal
47
* transactional events into GPB messages and sending those
48
* events out through registered replicators and appliers.
52
class TransactionServices
55
/** Our collection of replicator plugins */
56
std::vector<drizzled::plugin::Replicator *> replicators;
57
/** Our collection of applier plugins */
58
std::vector<drizzled::plugin::Applier *> appliers;
60
* Helper method which attaches a transaction context
61
* the supplied command based on the supplied Session's
62
* transaction information.
64
void setCommandTransactionContext(drizzled::message::Command *in_command, Session *in_session) const;
66
* Helper method which pushes a constructed message out
67
* to the registered replicator and applier plugins.
69
* @param Message to push out
71
void push(drizzled::message::Command *to_push);
74
* Attaches a replicator to our internal collection of
77
* @param Pointer to a replicator to attach/register
79
void attachReplicator(drizzled::plugin::Replicator *in_replicator);
81
* Detaches/unregisters a replicator with our internal
82
* collection of replicators.
84
* @param Pointer to the replicator to detach
86
void detachReplicator(drizzled::plugin::Replicator *in_replicator);
88
* Attaches a applier to our internal collection of
91
* @param Pointer to a applier to attach/register
93
void attachApplier(drizzled::plugin::Applier *in_applier);
95
* Detaches/unregisters a applier with our internal
96
* collection of appliers.
98
* @param Pointer to the applier to detach
100
void detachApplier(drizzled::plugin::Applier *in_applier);
102
* Creates a new StartTransaction GPB message and pushes
105
* @param Pointer to the Session starting the transaction
107
void startTransaction(Session *in_session);
109
* Creates a new CommitTransaction GPB message and pushes
112
* @param Pointer to the Session committing the transaction
114
void commitTransaction(Session *in_session);
116
* Creates a new RollbackTransaction GPB message and pushes
119
* @param Pointer to the Session committing the transaction
121
void rollbackTransaction(Session *in_session);
123
* Creates a new InsertRecord GPB message and pushes it to
126
* @param Pointer to the Session which has inserted a record
127
* @param Pointer to the Table containing insert information
129
void insertRecord(Session *in_session, Table *in_table);
131
* Creates a new UpdateRecord GPB message and pushes it to
134
* @param Pointer to the Session which has updated a record
135
* @param Pointer to the Table containing update information
137
void updateRecord(Session *in_session, Table *in_table, const unsigned char *, const unsigned char *);
139
* Creates a new DeleteRecord GPB message and pushes it to
142
* @param Pointer to the Session which has deleted a record
143
* @param Pointer to the Table containing delete information
145
void deleteRecord(Session *in_session, Table *in_table);
147
* Creates a new RawSql GPB message and pushes it to
150
* @TODO With a real data dictionary, this really shouldn't
151
* be needed. CREATE TABLE would map to insertRecord call
152
* on the I_S, etc. Not sure what to do with administrative
153
* commands like CHECK TABLE, though..
155
* @param Pointer to the Session which issued the statement
156
* @param Query string
157
* @param Length of the query string
159
void rawStatement(Session *in_session, const char *in_query, size_t in_query_len);
162
} /* end namespace drizzled */
28
165
/* todo, fill in this API */
29
166
/* these are the functions called by the rest of the drizzle server
30
167
to do whatever this plugin does. */