Coverage Report

Created: 2024-07-27 06:53

/src/rocksdb/utilities/transactions/lock/lock_manager.cc
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2
// This source code is licensed under both the GPLv2 (found in the
3
// COPYING file in the root directory) and Apache 2.0 License
4
// (found in the LICENSE.Apache file in the root directory).
5
6
7
#include "utilities/transactions/lock/lock_manager.h"
8
9
#include "utilities/transactions/lock/point/point_lock_manager.h"
10
11
namespace ROCKSDB_NAMESPACE {
12
13
std::shared_ptr<LockManager> NewLockManager(PessimisticTransactionDB* db,
14
0
                                            const TransactionDBOptions& opt) {
15
0
  assert(db);
16
0
  if (opt.lock_mgr_handle) {
17
    // A custom lock manager was provided in options
18
0
    auto mgr = opt.lock_mgr_handle->getLockManager();
19
0
    return std::shared_ptr<LockManager>(opt.lock_mgr_handle, mgr);
20
0
  } else {
21
    // Use a point lock manager by default
22
0
    return std::shared_ptr<LockManager>(new PointLockManager(db, opt));
23
0
  }
24
0
}
25
26
}  // namespace ROCKSDB_NAMESPACE
27