Storage Engine API
wiredtiger_begin_transaction_block.h
Go to the documentation of this file.
1 
30 #pragma once
31 
32 #include <string>
33 
34 #include <wiredtiger.h>
35 
36 #include "mongo/base/status.h"
37 #include "mongo/bson/timestamp.h"
38 
39 namespace mongo {
40 
46 public:
47  // Whether or not to ignore prepared transactions.
48  enum class IgnorePrepared {
49  kNoIgnore, // Do not ignore prepared transactions and return prepare conflicts.
50  kIgnore // Ignore prepared transactions and show prepared, but uncommitted data.
51  };
52 
53  // Whether or not to round up to the oldest timestamp when the read timestamp is behind it.
54  enum class RoundToOldest {
55  kNoRound, // Do not round to the oldest timestamp. BadValue error may be returned.
56  kRound // Round the read timestamp up to the oldest timestamp when it is behind.
57  };
58 
59  WiredTigerBeginTxnBlock(WT_SESSION* session,
60  IgnorePrepared ignorePrepared = IgnorePrepared::kNoIgnore);
61  WiredTigerBeginTxnBlock(WT_SESSION* session, const char* config);
63 
67  Status setTimestamp(Timestamp, RoundToOldest roundToOldest = RoundToOldest::kNoRound);
68 
73  void done();
74 
75 private:
76  WT_SESSION* _session;
77  bool _rollback = false;
78 };
79 
80 } // namespace mongo
Status setTimestamp(Timestamp, RoundToOldest roundToOldest=RoundToOldest::kNoRound)
Sets the read timestamp on the opened transaction.
Definition: wiredtiger_begin_transaction_block.cpp:64
void done()
End the begin transaction block.
Definition: wiredtiger_begin_transaction_block.cpp:84
IgnorePrepared
Definition: wiredtiger_begin_transaction_block.h:48
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
When constructed, this object begins a WiredTiger transaction on the provided session.
Definition: wiredtiger_begin_transaction_block.h:45
OperationContext Database StringData BSONObj CollectionOptions::ParseKind bool const BSONObj &idIndex Status
Definition: database_impl.cpp:956
WT_SESSION * _session
Definition: wiredtiger_begin_transaction_block.h:76
RoundToOldest
Definition: wiredtiger_begin_transaction_block.h:54
bool _rollback
Definition: wiredtiger_begin_transaction_block.h:77
WiredTigerBeginTxnBlock(WT_SESSION *session, IgnorePrepared ignorePrepared=IgnorePrepared::kNoIgnore)
Definition: wiredtiger_begin_transaction_block.cpp:43
~WiredTigerBeginTxnBlock()
Definition: wiredtiger_begin_transaction_block.cpp:58