~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/transaction_services.h

  • Committer: Brian Aker
  • Date: 2010-05-15 01:19:45 UTC
  • Revision ID: brian@gaz-20100515011945-uxhf94vi0tzm0vq6
Rename of KEY to KeyInfo

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#ifndef DRIZZLED_TRANSACTION_SERVICES_H
26
26
#define DRIZZLED_TRANSACTION_SERVICES_H
27
27
 
 
28
#include "drizzled/atomics.h"
28
29
#include "drizzled/message/transaction.pb.h"
29
30
 
30
31
namespace drizzled
49
50
{
50
51
public:
51
52
  static const size_t DEFAULT_RECORD_SIZE= 100;
 
53
  typedef uint64_t TransactionId;
52
54
  /**
53
55
   * Constructor
54
56
   */
55
 
  TransactionServices() {}
 
57
  TransactionServices()
 
58
  {
 
59
    /**
 
60
     * @todo set transaction ID to the last one from an applier...
 
61
     */
 
62
    current_transaction_id= 0;
 
63
  }
56
64
 
57
65
  /**
58
66
   * Singleton method
63
71
    static TransactionServices transaction_services;
64
72
    return transaction_services;
65
73
  }
 
74
 
 
75
  /**
 
76
   * Returns true if the transaction manager should construct
 
77
   * Transaction and Statement messages, false otherwise.
 
78
   */
 
79
  bool shouldConstructMessages();
66
80
  /**
67
81
   * Method which returns the active Transaction message
68
82
   * for the supplied Session.  If one is not found, a new Transaction
189
203
   *
190
204
   * @param Pointer to the Session committing the transaction
191
205
   */
192
 
  void commitTransactionMessage(Session *in_session);
 
206
  int commitTransactionMessage(Session *in_session);
193
207
  /** 
194
208
   * Marks the current active transaction message as being rolled back and
195
209
   * pushes the transaction message out to replicators.
293
307
   */
294
308
  void rawStatement(Session *in_session, const std::string &query);
295
309
  /* transactions: interface to plugin::StorageEngine functions */
296
 
  int ha_commit_one_phase(Session *session, bool all);
297
 
  int ha_rollback_trans(Session *session, bool all);
 
310
  int commitPhaseOne(Session *session, bool all);
 
311
  int rollbackTransaction(Session *session, bool all);
298
312
 
299
313
  /* transactions: these functions never call plugin::StorageEngine functions directly */
300
 
  int ha_commit_trans(Session *session, bool all);
301
 
  int ha_autocommit_or_rollback(Session *session, int error);
 
314
  int commitTransaction(Session *session, bool all);
 
315
  int autocommitOrRollback(Session *session, int error);
302
316
 
303
317
  /* savepoints */
304
 
  int ha_rollback_to_savepoint(Session *session, NamedSavepoint &sv);
305
 
  int ha_savepoint(Session *session, NamedSavepoint &sv);
306
 
  int ha_release_savepoint(Session *session, NamedSavepoint &sv);
307
 
  bool mysql_xa_recover(Session *session);
 
318
  int rollbackToSavepoint(Session *session, NamedSavepoint &sv);
 
319
  int setSavepoint(Session *session, NamedSavepoint &sv);
 
320
  int releaseSavepoint(Session *session, NamedSavepoint &sv);
308
321
 
309
322
  /**
310
323
   * Marks a storage engine as participating in a statement
383
396
                                      plugin::MonitoredInTransaction *monitored,
384
397
                                      plugin::TransactionalStorageEngine *engine,
385
398
                                      plugin::XaResourceManager *resource_manager);
 
399
  TransactionId getNextTransactionId()
 
400
  {
 
401
    return current_transaction_id.increment();
 
402
  }
 
403
  TransactionId getCurrentTransactionId()
 
404
  {
 
405
    return current_transaction_id;
 
406
  }
 
407
  /**
 
408
   * DEBUG ONLY.  See plugin::TransactionLog::truncate()
 
409
   */
 
410
  void resetTransactionId()
 
411
  {
 
412
    current_transaction_id= 0;
 
413
  }
 
414
private:
 
415
  atomic<TransactionId> current_transaction_id;
386
416
};
387
417
 
388
418
} /* namespace drizzled */