]>
git.proxmox.com Git - ceph.git/blob - 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).
10 #include "rocksdb/db.h"
11 #include "rocksdb/types.h"
13 namespace ROCKSDB_NAMESPACE
{
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.
19 KeyVersion() : user_key(""), value(""), sequence(0), type(0) {}
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
) {}
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.
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
,
41 std::vector
<KeyVersion
>* key_versions
);
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
);
47 } // namespace ROCKSDB_NAMESPACE
49 #endif // ROCKSDB_LITE