PageRenderTime 114ms CodeModel.GetById 50ms app.highlight 10ms RepoModel.GetById 51ms app.codeStats 0ms

/mordor/pq/transaction.h

http://github.com/mozy/mordor
C Header | 44 lines | 35 code | 8 blank | 1 comment | 0 complexity | 60f0fe42423b4ea921bf4bd6ccfaf3bb MD5 | raw file
 1#ifndef __MORDOR_PQ_TRANSACTION_H__
 2#define __MORDOR_PQ_TRANSACTION_H__
 3// Copyright (c) 2010 - Mozy, Inc.
 4
 5namespace Mordor {
 6namespace PQ {
 7
 8class Connection;
 9
10struct Transaction
11{
12public:
13    enum IsolationLevel
14    {
15        DEFAULT,
16        SERIALIZABLE,
17        REPEATABLE_READ = SERIALIZABLE,
18        READ_COMMITTED,
19        READ_UNCOMMITTED = READ_COMMITTED
20    };
21    enum Mode
22    {
23        READ_WRITE,
24        READ_ONLY
25    };
26
27public:
28    Transaction(Connection &connection, IsolationLevel isolationLevel
29        = DEFAULT);
30    Transaction(Connection &connection, IsolationLevel isolationLevel,
31        Mode mode);
32    ~Transaction();
33
34    void commit();
35    void rollback();
36
37private:
38    Connection &m_connection;
39    bool m_active;
40};
41
42}}
43
44#endif