]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/include/rocksdb/types.h
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / rocksdb / include / rocksdb / types.h
CommitLineData
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
FG
10
11namespace rocksdb {
12
13// Define all public custom types here.
14
15// Represents a sequence number in a WAL file.
16typedef uint64_t SequenceNumber;
17
494da23a
TL
18const SequenceNumber kMinUnCommittedSeq = 1; // 0 is always committed
19
11fdf7f2
TL
20// User-oriented representation of internal key types.
21enum EntryType {
22 kEntryPut,
23 kEntryDelete,
24 kEntrySingleDelete,
25 kEntryMerge,
26 kEntryRangeDeletion,
27 kEntryBlobIndex,
28 kEntryOther,
29};
30
31// <user key, sequence number, and entry type> tuple.
32struct FullKey {
33 Slice user_key;
34 SequenceNumber sequence;
35 EntryType type;
36
494da23a 37 FullKey() : sequence(0) {} // Intentionally left uninitialized (for speed)
11fdf7f2 38 FullKey(const Slice& u, const SequenceNumber& seq, EntryType t)
494da23a 39 : user_key(u), sequence(seq), type(t) {}
11fdf7f2 40 std::string DebugString(bool hex = false) const;
7c673cae 41
11fdf7f2
TL
42 void clear() {
43 user_key.clear();
44 sequence = 0;
45 type = EntryType::kEntryPut;
46 }
47};
48
49// Parse slice representing internal key to FullKey
50// Parsed FullKey is valid for as long as the memory pointed to by
51// internal_key is alive.
52bool ParseFullKey(const Slice& internal_key, FullKey* result);
53
54} // namespace rocksdb