]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/utilities/debug.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / rocksdb / include / rocksdb / utilities / debug.h
1 // Copyright (c) 2017-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).
5
6 #pragma once
7
8 #ifndef ROCKSDB_LITE
9
10 #include "rocksdb/db.h"
11 #include "rocksdb/types.h"
12
13 namespace ROCKSDB_NAMESPACE {
14
15 // Data associated with a particular version of a key. A database may internally
16 // store multiple versions of a same user key due to snapshots, compaction not
17 // happening yet, etc.
18 struct KeyVersion {
19 KeyVersion() : user_key(""), value(""), sequence(0), type(0) {}
20
21 KeyVersion(const std::string& _user_key, const std::string& _value,
22 SequenceNumber _sequence, int _type)
23 : user_key(_user_key), value(_value), sequence(_sequence), type(_type) {}
24
25 std::string user_key;
26 std::string value;
27 SequenceNumber sequence;
28 // TODO(ajkr): we should provide a helper function that converts the int to a
29 // string describing the type for easier debugging.
30 int type;
31 };
32
33 // Returns listing of all versions of keys in the provided user key range.
34 // The range is inclusive-inclusive, i.e., [`begin_key`, `end_key`], or
35 // `max_num_ikeys` has been reached. Since all those keys returned will be
36 // copied to memory, if the range covers too many keys, the memory usage
37 // may be huge. `max_num_ikeys` can be used to cap the memory usage.
38 // The result is inserted into the provided vector, `key_versions`.
39 Status GetAllKeyVersions(DB* db, Slice begin_key, Slice end_key,
40 size_t max_num_ikeys,
41 std::vector<KeyVersion>* key_versions);
42
43 Status GetAllKeyVersions(DB* db, ColumnFamilyHandle* cfh, Slice begin_key,
44 Slice end_key, size_t max_num_ikeys,
45 std::vector<KeyVersion>* key_versions);
46
47 } // namespace ROCKSDB_NAMESPACE
48
49 #endif // ROCKSDB_LITE