]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
11fdf7f2 TL |
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). | |
7c673cae | 5 | |
11fdf7f2 | 6 | #pragma once |
7c673cae FG |
7 | |
8 | #include <stdint.h> | |
11fdf7f2 | 9 | #include "rocksdb/slice.h" |
7c673cae | 10 | |
f67539c2 | 11 | namespace ROCKSDB_NAMESPACE { |
7c673cae FG |
12 | |
13 | // Define all public custom types here. | |
14 | ||
20effc67 TL |
15 | using ColumnFamilyId = uint32_t; |
16 | ||
7c673cae FG |
17 | // Represents a sequence number in a WAL file. |
18 | typedef uint64_t SequenceNumber; | |
19 | ||
494da23a TL |
20 | const SequenceNumber kMinUnCommittedSeq = 1; // 0 is always committed |
21 | ||
20effc67 TL |
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 | ||
11fdf7f2 | 38 | // User-oriented representation of internal key types. |
20effc67 | 39 | // Ordering of this enum entries should not change. |
11fdf7f2 TL |
40 | enum EntryType { |
41 | kEntryPut, | |
42 | kEntryDelete, | |
43 | kEntrySingleDelete, | |
44 | kEntryMerge, | |
45 | kEntryRangeDeletion, | |
46 | kEntryBlobIndex, | |
20effc67 | 47 | kEntryDeleteWithTimestamp, |
11fdf7f2 TL |
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 | ||
494da23a | 57 | FullKey() : sequence(0) {} // Intentionally left uninitialized (for speed) |
11fdf7f2 | 58 | FullKey(const Slice& u, const SequenceNumber& seq, EntryType t) |
494da23a | 59 | : user_key(u), sequence(seq), type(t) {} |
11fdf7f2 | 60 | std::string DebugString(bool hex = false) const; |
7c673cae | 61 | |
11fdf7f2 TL |
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 | ||
f67539c2 | 74 | } // namespace ROCKSDB_NAMESPACE |