90
91
* This method properly sets the is_active member variable.
92
93
void evaluateActivePlugins();
94
* Helper method which returns the active Transaction message
95
* for the supplied Session. If one is not found, a new Transaction
96
* message is allocated, initialized, and returned.
98
* @param The session processing the transaction
100
message::Transaction *getActiveTransaction(Session *in_session) const;
102
* Helper method which attaches a transaction context
103
* the supplied transaction based on the supplied Session's
104
* transaction information. This method also ensure the
105
* transaction message is attached properly to the Session object
107
* @param The transaction message to initialize
108
* @param The Session processing this transaction
110
void initTransaction(message::Transaction &in_command, Session *in_session) const;
112
* Helper method which finalizes data members for the
113
* supplied transaction's context.
115
* @param The transaction message to finalize
116
* @param The Session processing this transaction
118
void finalizeTransaction(message::Transaction &in_command, Session *in_session) const;
120
* Helper method which deletes transaction memory and
121
* unsets Session's transaction and statement messages.
123
void cleanupTransaction(message::Transaction *in_transaction,
124
Session *in_session) const;
126
* Returns true if the transaction contains any Statement
127
* messages which are not end segments (i.e. a bulk statement has
128
* previously been sent to replicators).
130
* @param The transaction to check
132
bool transactionContainsBulkSegment(const message::Transaction &transaction) const;
134
* Helper method which initializes a Statement message
136
* @param The statement to initialize
137
* @param The type of the statement
138
* @param The session processing this statement
140
void initStatement(message::Statement &statement,
141
message::Statement::Type in_type,
142
Session *in_session) const;
144
* Helper method which returns an initialized Statement
145
* message for methods doing insertion of data.
147
* @param[in] Pointer to the Session doing the processing
148
* @param[in] Pointer to the Table object being inserted into
150
message::Statement &getInsertStatement(Session *in_session,
151
Table *in_table) const;
154
* Helper method which initializes the header message for
157
* @param[inout] Statement message container to modify
158
* @param[in] Pointer to the Session doing the processing
159
* @param[in] Pointer to the Table being inserted into
161
void setInsertHeader(message::Statement &statement,
163
Table *in_table) const;
165
* Helper method which returns an initialized Statement
166
* message for methods doing updates of data.
168
* @param[in] Pointer to the Session doing the processing
169
* @param[in] Pointer to the Table object being updated
170
* @param[in] Pointer to the old data in the record
171
* @param[in] Pointer to the new data in the record
173
message::Statement &getUpdateStatement(Session *in_session,
175
const unsigned char *old_record,
176
const unsigned char *new_record) const;
178
* Helper method which initializes the header message for
181
* @param[inout] Statement message container to modify
182
* @param[in] Pointer to the Session doing the processing
183
* @param[in] Pointer to the Table being updated
184
* @param[in] Pointer to the old data in the record
185
* @param[in] Pointer to the new data in the record
187
void setUpdateHeader(message::Statement &statement,
190
const unsigned char *old_record,
191
const unsigned char *new_record) const;
193
* Helper method which returns an initialized Statement
194
* message for methods doing deletion of data.
196
* @param[in] Pointer to the Session doing the processing
197
* @param[in] Pointer to the Table object being deleted from
199
message::Statement &getDeleteStatement(Session *in_session,
200
Table *in_table) const;
203
* Helper method which initializes the header message for
206
* @param[inout] Statement message container to modify
207
* @param[in] Pointer to the Session doing the processing
208
* @param[in] Pointer to the Table being deleted from
210
void setDeleteHeader(message::Statement &statement,
212
Table *in_table) const;
214
* Helper method which pushes a constructed message out
215
* to the registered replicator and applier plugins.
96
* Helper method which pushes a constructed message out to the registered
97
* replicator and applier plugins.
217
99
* @param Message to push out
219
void push(message::Transaction &to_push);
101
void pushTransactionMessage(message::Transaction &to_push);
267
148
* @param Pointer to the applier to detach
269
150
void detachApplier(plugin::TransactionApplier *in_applier);
271
* Commits a normal transaction (see above) and pushes the
272
* transaction message out to the replicators.
274
* @param Pointer to the Session committing the transaction
276
void commitTransaction(Session *in_session);
278
* Marks the current active transaction message as being rolled
279
* back and pushes the transaction message out to replicators.
281
* @param Pointer to the Session committing the transaction
283
void rollbackTransaction(Session *in_session);
285
* Finalizes a Statement message and sets the Session's statement
288
* @param The statement to initialize
289
* @param The session processing this statement
291
void finalizeStatement(message::Statement &statement,
292
Session *in_session) const;
294
* Creates a new InsertRecord GPB message and pushes it to
297
* @param Pointer to the Session which has inserted a record
298
* @param Pointer to the Table containing insert information
300
* Grr, returning "true" here on error because of the cursor
301
* reversed bool return crap...fix that.
303
bool insertRecord(Session *in_session, Table *in_table);
305
* Creates a new UpdateRecord GPB message and pushes it to
308
* @param Pointer to the Session which has updated a record
309
* @param Pointer to the Table containing update information
310
* @param Pointer to the raw bytes representing the old record/row
311
* @param Pointer to the raw bytes representing the new record/row
313
void updateRecord(Session *in_session,
315
const unsigned char *old_record,
316
const unsigned char *new_record);
318
* Creates a new DeleteRecord GPB message and pushes it to
321
* @param Pointer to the Session which has deleted a record
322
* @param Pointer to the Table containing delete information
324
void deleteRecord(Session *in_session, Table *in_table);
326
* Creates a CreateSchema Statement GPB message and adds it
327
* to the Session's active Transaction GPB message for pushing
328
* out to the replicator streams.
330
* @param[in] Pointer to the Session which issued the statement
331
* @param[in] message::Schema message describing new schema
333
void createSchema(Session *in_session, const message::Schema &schema);
335
* Creates a DropSchema Statement GPB message and adds it
336
* to the Session's active Transaction GPB message for pushing
337
* out to the replicator streams.
339
* @param[in] Pointer to the Session which issued the statement
340
* @param[in] message::Schema message describing new schema
342
void dropSchema(Session *in_session, const std::string &schema_name);
344
* Creates a CreateTable Statement GPB message and adds it
345
* to the Session's active Transaction GPB message for pushing
346
* out to the replicator streams.
348
* @param[in] Pointer to the Session which issued the statement
349
* @param[in] message::Table message describing new schema
351
void createTable(Session *in_session, const message::Table &table);
353
* Creates a DropTable Statement GPB message and adds it
354
* to the Session's active Transaction GPB message for pushing
355
* out to the replicator streams.
357
* @param[in] Pointer to the Session which issued the statement
358
* @param[in] The schema of the table being dropped
359
* @param[in] The table name of the table being dropped
360
* @param[in] Did the user specify an IF EXISTS clause?
362
void dropTable(Session *in_session,
363
const std::string &schema_name,
364
const std::string &table_name,
367
* Creates a TruncateTable Statement GPB message and adds it
368
* to the Session's active Transaction GPB message for pushing
369
* out to the replicator streams.
371
* @param[in] Pointer to the Session which issued the statement
372
* @param[in] The Table being truncated
374
void truncateTable(Session *in_session, Table *in_table);
376
* Creates a new RawSql GPB message and pushes it to
379
* @TODO With a real data dictionary, this really shouldn't
380
* be needed. CREATE TABLE would map to insertRecord call
381
* on the I_S, etc. Not sure what to do with administrative
382
* commands like CHECK TABLE, though..
384
* @param Pointer to the Session which issued the statement
385
* @param Query string
387
void rawStatement(Session *in_session, const std::string &query);
389
* Returns the timestamp of the last Transaction which was sent to
151
/** Returns the timestamp of the last Transaction which was sent to an
392
154
uint64_t getLastAppliedTimestamp() const;