21
21
22
22
namespace bustub {
23
23
24
- auto Insert (Transaction *txn, BustubInstance &instance, int v1) -> void {
24
+ auto Insert (Transaction *txn, BusTubInstance &instance, int v1) -> void {
25
25
std::stringstream ss;
26
26
auto writer = bustub::SimpleStreamWriter (ss, true , " ," );
27
27
fmt::print (stderr, " insert data with v1 = {} in txn {} {}\n " , v1, txn->GetTransactionId (), txn->GetIsolationLevel ());
@@ -38,7 +38,7 @@ auto Insert(Transaction *txn, BustubInstance &instance, int v1) -> void {
38
38
// / This overloaded function will then bound each pair from @v1_vec & @v2_vec as a insert value
39
39
// / If flag is set to `true`, v1_vec should contain exactly one element,
40
40
// / The insert pair will be {v1_vec[0], v2_vec[0]}, {v1_vec[0], v2_vec[1]} ...
41
- auto Insert (Transaction *txn, BustubInstance &instance, const std::vector<int > &v1_vec, const std::vector<int > &v2_vec,
41
+ auto Insert (Transaction *txn, BusTubInstance &instance, const std::vector<int > &v1_vec, const std::vector<int > &v2_vec,
42
42
bool flag = false ) -> void {
43
43
// Check if the input vectors have the same size.
44
44
if (!flag) {
@@ -95,7 +95,7 @@ auto Insert(Transaction *txn, BustubInstance &instance, const std::vector<int> &
95
95
ASSERT_EQ (ss.str (), fmt::format (" {},\n " , v2_vec.size ()));
96
96
}
97
97
98
- auto Delete (Transaction *txn, BustubInstance &instance, int v1) -> void {
98
+ auto Delete (Transaction *txn, BusTubInstance &instance, int v1) -> void {
99
99
std::stringstream ss;
100
100
auto writer = bustub::SimpleStreamWriter (ss, true , " ," );
101
101
fmt::print (stderr, " delete data with v1 = {} in txn {} {}\n " , v1, txn->GetTransactionId (), txn->GetIsolationLevel ());
@@ -109,7 +109,7 @@ auto Delete(Transaction *txn, BustubInstance &instance, int v1) -> void {
109
109
// / @param d_size The size you expect to be deleted from t1, will be used as sanity check, default value is 3
110
110
// / This overloaded function performs a vectorized self-constructed deletion to better test the implementation
111
111
// / You should calculate the number of elements that logically should be deleted, and pass it in as @d_size.
112
- auto Delete (Transaction *txn, BustubInstance &instance, const std::vector<int > &d_vec, int d_size = 3 ) -> void {
112
+ auto Delete (Transaction *txn, BusTubInstance &instance, const std::vector<int > &d_vec, int d_size = 3 ) -> void {
113
113
if (d_vec.empty ()) {
114
114
fmt::print (stderr, " Input vec must not be empty\n " );
115
115
return ;
@@ -148,7 +148,7 @@ auto ExpectResult(const std::string &actual_result, const std::string &expected_
148
148
return actual_result_rows == expected_result_rows;
149
149
}
150
150
151
- auto Scan (Transaction *txn, BustubInstance &instance, const std::vector<int > &v1) -> void {
151
+ auto Scan (Transaction *txn, BusTubInstance &instance, const std::vector<int > &v1) -> void {
152
152
std::stringstream ss;
153
153
auto writer = bustub::SimpleStreamWriter (ss, true , " ," );
154
154
fmt::print (stderr, " scan data expect v1 in range {} in txn {} {}\n " , v1, txn->GetTransactionId (),
@@ -166,28 +166,28 @@ auto Scan(Transaction *txn, BustubInstance &instance, const std::vector<int> &v1
166
166
}
167
167
}
168
168
169
- void Commit (BustubInstance &instance, Transaction *&txn) {
169
+ void Commit (BusTubInstance &instance, Transaction *&txn) {
170
170
fmt::print (stderr, " commit txn {} in {}\n " , txn->GetTransactionId (), txn->GetIsolationLevel ());
171
171
instance.txn_manager_ ->Commit (txn);
172
172
delete txn;
173
173
txn = nullptr ;
174
174
}
175
175
176
- void Abort (BustubInstance &instance, Transaction *&txn) {
176
+ void Abort (BusTubInstance &instance, Transaction *&txn) {
177
177
fmt::print (stderr, " abort txn {} in {}\n " , txn->GetTransactionId (), txn->GetIsolationLevel ());
178
178
instance.txn_manager_ ->Abort (txn);
179
179
delete txn;
180
180
txn = nullptr ;
181
181
}
182
182
183
- auto Begin (BustubInstance &instance, IsolationLevel level) -> Transaction * {
183
+ auto Begin (BusTubInstance &instance, IsolationLevel level) -> Transaction * {
184
184
auto txn = instance.txn_manager_ ->Begin (nullptr , level);
185
185
fmt::print (stderr, " start txn {} in {}\n " , txn->GetTransactionId (), txn->GetIsolationLevel ());
186
186
return txn;
187
187
}
188
188
189
- auto GetDbForVisibilityTest (const std::string &name) -> std::shared_ptr<BustubInstance > {
190
- auto instance = std::make_unique<BustubInstance >();
189
+ auto GetDbForVisibilityTest (const std::string &name) -> std::shared_ptr<BusTubInstance > {
190
+ auto instance = std::make_unique<BusTubInstance >();
191
191
auto writer = bustub::SimpleStreamWriter (std::cout, true );
192
192
fmt::print (stderr, " --- TEST CASE {} ---\n " , name);
193
193
fmt::print (stderr, " prepare\n " );
@@ -196,8 +196,8 @@ auto GetDbForVisibilityTest(const std::string &name) -> std::shared_ptr<BustubIn
196
196
return instance;
197
197
}
198
198
199
- auto GetDbForCommitAbortTest (const std::string &name) -> std::shared_ptr<BustubInstance > {
200
- auto instance = std::make_unique<BustubInstance >();
199
+ auto GetDbForCommitAbortTest (const std::string &name) -> std::shared_ptr<BusTubInstance > {
200
+ auto instance = std::make_unique<BusTubInstance >();
201
201
auto writer = bustub::SimpleStreamWriter (std::cout, true );
202
202
fmt::print (stderr, " --- TEST CASE {} ---\n " , name);
203
203
fmt::print (stderr, " prepare\n " );
@@ -213,8 +213,8 @@ enum class ExpectedOutcome {
213
213
BlockOnWrite,
214
214
};
215
215
216
- auto GetDbForIsolationTest () -> std::shared_ptr<BustubInstance > {
217
- auto instance = std::make_unique<BustubInstance >();
216
+ auto GetDbForIsolationTest () -> std::shared_ptr<BusTubInstance > {
217
+ auto instance = std::make_unique<BusTubInstance >();
218
218
auto writer = bustub::SimpleStreamWriter (std::cout, true );
219
219
fmt::print (stderr, " 0: prepare\n " );
220
220
// in case you implemented scan filter pushdown... disable it by forcing starter rule!
@@ -226,7 +226,7 @@ auto GetDbForIsolationTest() -> std::shared_ptr<BustubInstance> {
226
226
return instance;
227
227
}
228
228
229
- auto StartReadTxn (IsolationLevel read_txn_level, BustubInstance &instance, bool read_before_write) -> Transaction * {
229
+ auto StartReadTxn (IsolationLevel read_txn_level, BusTubInstance &instance, bool read_before_write) -> Transaction * {
230
230
fmt::print (stderr, " 1: read txn: {}\n " , read_txn_level);
231
231
auto txn_r = instance.txn_manager_ ->Begin (nullptr , read_txn_level);
232
232
if (read_before_write) {
@@ -253,7 +253,7 @@ auto StartReadTxn(IsolationLevel read_txn_level, BustubInstance &instance, bool
253
253
return txn_r;
254
254
}
255
255
256
- auto StartWriteTxn (IsolationLevel write_txn_level, BustubInstance &instance, bool is_delete) -> Transaction * {
256
+ auto StartWriteTxn (IsolationLevel write_txn_level, BusTubInstance &instance, bool is_delete) -> Transaction * {
257
257
auto writer = bustub::SimpleStreamWriter (std::cout, true );
258
258
fmt::print (stderr, " 2: write txn: {}\n " , write_txn_level);
259
259
auto txn_w = instance.txn_manager_ ->Begin (nullptr , write_txn_level);
@@ -273,7 +273,7 @@ auto StartWriteTxn(IsolationLevel write_txn_level, BustubInstance &instance, boo
273
273
return txn_w;
274
274
}
275
275
276
- auto TryRead (Transaction *txn_r, BustubInstance &instance, ExpectedOutcome o, bool is_delete,
276
+ auto TryRead (Transaction *txn_r, BusTubInstance &instance, ExpectedOutcome o, bool is_delete,
277
277
std::atomic<bool > &check_done) -> bool {
278
278
bool ret = false ;
279
279
std::stringstream result;
0 commit comments