]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | // Copyright (c) Meta Platforms, Inc. and affiliates. |
2 | // | |
3 | // This source code is licensed under both the GPLv2 (found in the | |
4 | // COPYING file in the root directory) and Apache 2.0 License | |
5 | // (found in the LICENSE.Apache file in the root directory). | |
6 | ||
7 | // | |
8 | // Generic definitions for a Range-based Lock Manager | |
9 | // | |
10 | #pragma once | |
11 | #ifndef ROCKSDB_LITE | |
12 | ||
13 | #include "utilities/transactions/lock/lock_manager.h" | |
14 | ||
15 | namespace ROCKSDB_NAMESPACE { | |
16 | ||
17 | /* | |
18 | A base class for all Range-based lock managers | |
19 | ||
20 | See also class RangeLockManagerHandle in | |
21 | include/rocksdb/utilities/transaction_db.h | |
22 | */ | |
23 | class RangeLockManagerBase : public LockManager { | |
24 | public: | |
25 | // Geting a point lock is reduced to getting a range lock on a single-point | |
26 | // range | |
27 | using LockManager::TryLock; | |
28 | Status TryLock(PessimisticTransaction* txn, ColumnFamilyId column_family_id, | |
29 | const std::string& key, Env* env, bool exclusive) override { | |
30 | Endpoint endp(key.data(), key.size(), false); | |
31 | return TryLock(txn, column_family_id, endp, endp, env, exclusive); | |
32 | } | |
33 | }; | |
34 | ||
35 | } // namespace ROCKSDB_NAMESPACE | |
36 | #endif // ROCKSDB_LITE |