-
Notifications
You must be signed in to change notification settings - Fork 207
/
Copy pathtypes.h
61 lines (48 loc) · 1.51 KB
/
types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#pragma once
#include <stdint.h>
#include "rocksdb/slice.h"
#include "rocksdb/terark_namespace.h"
namespace TERARKDB_NAMESPACE {
// Define all public custom types here.
// Represents a sequence number in a WAL file.
typedef uint64_t SequenceNumber;
// Dependence pair
struct Dependence {
uint64_t file_number;
uint64_t entry_count;
};
// User-oriented representation of internal key types.
enum EntryType {
kEntryPut,
kEntryDelete,
kEntrySingleDelete,
kEntryMerge,
kEntryRangeDeletion,
kEntryValueIndex,
kEntryMergeIndex,
kEntryOther,
};
// <user key, sequence number, and entry type> tuple.
struct FullKey {
Slice user_key;
SequenceNumber sequence;
EntryType type;
FullKey() : sequence(0) {} // Intentionally left uninitialized (for speed)
FullKey(const Slice& u, const SequenceNumber& seq, EntryType t)
: user_key(u), sequence(seq), type(t) {}
std::string DebugString(bool hex = false) const;
void clear() {
user_key.clear();
sequence = 0;
type = EntryType::kEntryPut;
}
};
// Parse slice representing internal key to FullKey
// Parsed FullKey is valid for as long as the memory pointed to by
// internal_key is alive.
bool ParseFullKey(const Slice& internal_key, FullKey* result);
} // namespace TERARKDB_NAMESPACE