]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/snapshot.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
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).
8 #include "rocksdb/types.h"
10 namespace ROCKSDB_NAMESPACE
{
14 // Abstract handle to particular state of a DB.
15 // A Snapshot is an immutable object and can therefore be safely
16 // accessed from multiple threads without any external synchronization.
18 // To Create a Snapshot, call DB::GetSnapshot().
19 // To Destroy a Snapshot, call DB::ReleaseSnapshot(snapshot).
22 // returns Snapshot's sequence number
23 virtual SequenceNumber
GetSequenceNumber() const = 0;
29 // Simple RAII wrapper class for Snapshot.
30 // Constructing this object will create a snapshot. Destructing will
31 // release the snapshot.
32 class ManagedSnapshot
{
34 explicit ManagedSnapshot(DB
* db
);
36 // Instead of creating a snapshot, take ownership of the input snapshot.
37 ManagedSnapshot(DB
* db
, const Snapshot
* _snapshot
);
41 const Snapshot
* snapshot();
45 const Snapshot
* snapshot_
;
48 } // namespace ROCKSDB_NAMESPACE