YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/common/transaction-test-util.cc
Line
Count
Source (jump to first uncovered line)
1
//
2
// Copyright (c) YugaByte, Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
// in compliance with the License.  You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software distributed under the License
10
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
// or implied.  See the License for the specific language governing permissions and limitations
12
// under the License.
13
//
14
//
15
#include "yb/common/transaction-test-util.h"
16
17
#include "yb/util/status_format.h"
18
19
namespace yb {
20
21
0
void TransactionStatusManagerMock::RequestStatusAt(const StatusRequest& request) {
22
0
  auto it = txn_commit_time_.find(*request.id);
23
0
  if (it == txn_commit_time_.end()) {
24
0
    request.callback(STATUS_FORMAT(TryAgain, "Unknown transaction id: $0", *request.id));
25
0
  } else {
26
0
    if (request.read_ht >= it->second) {
27
0
      request.callback(TransactionStatusResult{TransactionStatus::COMMITTED, it->second});
28
0
    } else {
29
0
      request.callback(TransactionStatusResult{TransactionStatus::PENDING, HybridTime::kMin});
30
0
    }
31
0
  }
32
0
}
33
34
} // namespace yb