mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-29 18:33:58 +00:00
e5c5f23814
Summary: D51183 was reverted due to breaking the LITE build. This diff is the same as D51183 but with a fix for the LITE BUILD(D51693) Test Plan: run all unit tests Reviewers: sdong Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D51711
27 lines
797 B
C++
27 lines
797 B
C++
// Copyright (c) 2015, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
#include "rocksdb/snapshot.h"
|
|
|
|
#include "rocksdb/db.h"
|
|
|
|
namespace rocksdb {
|
|
|
|
ManagedSnapshot::ManagedSnapshot(DB* db) : db_(db),
|
|
snapshot_(db->GetSnapshot()) {}
|
|
|
|
ManagedSnapshot::ManagedSnapshot(DB* db, const Snapshot* _snapshot)
|
|
: db_(db), snapshot_(_snapshot) {}
|
|
|
|
ManagedSnapshot::~ManagedSnapshot() {
|
|
if (snapshot_) {
|
|
db_->ReleaseSnapshot(snapshot_);
|
|
}
|
|
}
|
|
|
|
const Snapshot* ManagedSnapshot::snapshot() { return snapshot_;}
|
|
|
|
} // namespace rocksdb
|