]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
11fdf7f2 TL |
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). | |
7c673cae | 5 | |
7c673cae | 6 | #include "rocksdb/db.h" |
1e59de90 | 7 | #include "rocksdb/snapshot.h" |
7c673cae | 8 | |
f67539c2 | 9 | namespace ROCKSDB_NAMESPACE { |
7c673cae | 10 | |
1e59de90 TL |
11 | ManagedSnapshot::ManagedSnapshot(DB* db) |
12 | : db_(db), snapshot_(db->GetSnapshot()) {} | |
7c673cae FG |
13 | |
14 | ManagedSnapshot::ManagedSnapshot(DB* db, const Snapshot* _snapshot) | |
15 | : db_(db), snapshot_(_snapshot) {} | |
16 | ||
17 | ManagedSnapshot::~ManagedSnapshot() { | |
18 | if (snapshot_) { | |
19 | db_->ReleaseSnapshot(snapshot_); | |
20 | } | |
21 | } | |
22 | ||
1e59de90 | 23 | const Snapshot* ManagedSnapshot::snapshot() { return snapshot_; } |
7c673cae | 24 | |
f67539c2 | 25 | } // namespace ROCKSDB_NAMESPACE |