|
| 1 | +//////////////////////////////////////////////////////////////////////////////// |
| 2 | +/// DISCLAIMER |
| 3 | +/// |
| 4 | +/// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany |
| 5 | +/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany |
| 6 | +/// |
| 7 | +/// Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +/// you may not use this file except in compliance with the License. |
| 9 | +/// You may obtain a copy of the License at |
| 10 | +/// |
| 11 | +/// http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +/// |
| 13 | +/// Unless required by applicable law or agreed to in writing, software |
| 14 | +/// distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +/// See the License for the specific language governing permissions and |
| 17 | +/// limitations under the License. |
| 18 | +/// |
| 19 | +/// Copyright holder is ArangoDB GmbH, Cologne, Germany |
| 20 | +/// |
| 21 | +/// @author Simon Grätzer |
| 22 | +//////////////////////////////////////////////////////////////////////////////// |
| 23 | + |
| 24 | +#include "RocksDBBatchedWithIndexMethods.h" |
| 25 | + |
| 26 | +using namespace arangodb; |
| 27 | + |
| 28 | +RocksDBBatchedWithIndexMethods::RocksDBBatchedWithIndexMethods(rocksdb::TransactionDB* db, |
| 29 | + rocksdb::WriteBatchWithIndex* wb) |
| 30 | + : RocksDBMethods(), _db(db), _wb(wb) { |
| 31 | + TRI_ASSERT(_db != nullptr); |
| 32 | + TRI_ASSERT(_wb != nullptr); |
| 33 | +} |
| 34 | + |
| 35 | +rocksdb::Status RocksDBBatchedWithIndexMethods::Get(rocksdb::ColumnFamilyHandle* cf, |
| 36 | + rocksdb::Slice const& key, |
| 37 | + rocksdb::PinnableSlice* val) { |
| 38 | + TRI_ASSERT(cf != nullptr); |
| 39 | + rocksdb::ReadOptions ro; |
| 40 | + return _wb->GetFromBatchAndDB(_db, ro, cf, key, val); |
| 41 | +} |
| 42 | + |
| 43 | +rocksdb::Status RocksDBBatchedWithIndexMethods::GetForUpdate(rocksdb::ColumnFamilyHandle* cf, |
| 44 | + rocksdb::Slice const& key, |
| 45 | + rocksdb::PinnableSlice* val) { |
| 46 | + return this->Get(cf, key, val); |
| 47 | +} |
| 48 | + |
| 49 | +rocksdb::Status RocksDBBatchedWithIndexMethods::Put(rocksdb::ColumnFamilyHandle* cf, |
| 50 | + RocksDBKey const& key, |
| 51 | + rocksdb::Slice const& val, |
| 52 | + bool assume_tracked) { |
| 53 | + TRI_ASSERT(cf != nullptr); |
| 54 | + return _wb->Put(cf, key.string(), val); |
| 55 | +} |
| 56 | + |
| 57 | +rocksdb::Status RocksDBBatchedWithIndexMethods::PutUntracked(rocksdb::ColumnFamilyHandle* cf, |
| 58 | + RocksDBKey const& key, |
| 59 | + rocksdb::Slice const& val) { |
| 60 | + return RocksDBBatchedWithIndexMethods::Put(cf, key, val, /*assume_tracked*/false); |
| 61 | +} |
| 62 | + |
| 63 | +rocksdb::Status RocksDBBatchedWithIndexMethods::Delete(rocksdb::ColumnFamilyHandle* cf, |
| 64 | + RocksDBKey const& key) { |
| 65 | + TRI_ASSERT(cf != nullptr); |
| 66 | + return _wb->Delete(cf, key.string()); |
| 67 | +} |
| 68 | + |
| 69 | +rocksdb::Status RocksDBBatchedWithIndexMethods::SingleDelete(rocksdb::ColumnFamilyHandle* cf, |
| 70 | + RocksDBKey const& key) { |
| 71 | + TRI_ASSERT(cf != nullptr); |
| 72 | + return _wb->SingleDelete(cf, key.string()); |
| 73 | +} |
| 74 | + |
| 75 | +void RocksDBBatchedWithIndexMethods::PutLogData(rocksdb::Slice const& blob) { |
| 76 | + _wb->PutLogData(blob); |
| 77 | +} |
0 commit comments