]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/types.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / include / rocksdb / types.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).
5
6 #pragma once
7
8 #include <stdint.h>
9 #include "rocksdb/slice.h"
10
11 namespace ROCKSDB_NAMESPACE {
12
13 // Define all public custom types here.
14
15 using ColumnFamilyId = uint32_t;
16
17 // Represents a sequence number in a WAL file.
18 typedef uint64_t SequenceNumber;
19
20 const SequenceNumber kMinUnCommittedSeq = 1; // 0 is always committed
21
22 // The types of files RocksDB uses in a DB directory. (Available for
23 // advanced options.)
24 enum FileType {
25 kWalFile,
26 kDBLockFile,
27 kTableFile,
28 kDescriptorFile,
29 kCurrentFile,
30 kTempFile,
31 kInfoLogFile, // Either the current one, or an old one
32 kMetaDatabase,
33 kIdentityFile,
34 kOptionsFile,
35 kBlobFile
36 };
37
38 // User-oriented representation of internal key types.
39 // Ordering of this enum entries should not change.
40 enum EntryType {
41 kEntryPut,
42 kEntryDelete,
43 kEntrySingleDelete,
44 kEntryMerge,
45 kEntryRangeDeletion,
46 kEntryBlobIndex,
47 kEntryDeleteWithTimestamp,
48 kEntryOther,
49 };
50
51 // <user key, sequence number, and entry type> tuple.
52 struct FullKey {
53 Slice user_key;
54 SequenceNumber sequence;
55 EntryType type;
56
57 FullKey() : sequence(0) {} // Intentionally left uninitialized (for speed)
58 FullKey(const Slice& u, const SequenceNumber& seq, EntryType t)
59 : user_key(u), sequence(seq), type(t) {}
60 std::string DebugString(bool hex = false) const;
61
62 void clear() {
63 user_key.clear();
64 sequence = 0;
65 type = EntryType::kEntryPut;
66 }
67 };
68
69 // Parse slice representing internal key to FullKey
70 // Parsed FullKey is valid for as long as the memory pointed to by
71 // internal_key is alive.
72 bool ParseFullKey(const Slice& internal_key, FullKey* result);
73
74 } // namespace ROCKSDB_NAMESPACE