mirror of
https://github.com/facebook/rocksdb.git
synced 2024-12-02 01:16:16 +00:00
d8bd9fc7b3
Summary: This PR has two commits: 1. Modify the code to allow different Lock Managers (of any kind) to be used. It is implied that a LockManager uses its own custom LockTracker. 2. Add definitions for Range Locking (class Endpoint and GetRangeLock() function. cheng-chang, is this what you've had in mind (should the PR have both item 1 and item 2?) Pull Request resolved: https://github.com/facebook/rocksdb/pull/7443 Reviewed By: zhichao-cao Differential Revision: D24123172 Pulled By: cheng-chang fbshipit-source-id: c6548ad6d4cc3c25f68d13b29147bc6fdf357185
30 lines
996 B
C++
30 lines
996 B
C++
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
|
|
#ifndef ROCKSDB_LITE
|
|
|
|
#include "utilities/transactions/lock/lock_manager.h"
|
|
|
|
#include "utilities/transactions/lock/point/point_lock_manager.h"
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
|
|
std::shared_ptr<LockManager> NewLockManager(PessimisticTransactionDB* db,
|
|
const TransactionDBOptions& opt) {
|
|
assert(db);
|
|
if (opt.lock_mgr_handle) {
|
|
// A custom lock manager was provided in options
|
|
auto mgr = opt.lock_mgr_handle->getLockManager();
|
|
return std::shared_ptr<LockManager>(opt.lock_mgr_handle, mgr);
|
|
} else {
|
|
// Use a point lock manager by default
|
|
return std::shared_ptr<LockManager>(new PointLockManager(db, opt));
|
|
}
|
|
}
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|
|
|
|
#endif // ROCKSDB_LITE
|