]>
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 FG |
5 | #pragma once |
6 | #ifndef ROCKSDB_LITE | |
7 | ||
8 | #include <string> | |
9 | #include <vector> | |
10 | #include "db/dbformat.h" | |
11 | #include "include/rocksdb/env.h" | |
12 | #include "include/rocksdb/listener.h" | |
13 | #include "include/rocksdb/options.h" | |
14 | #include "include/rocksdb/status.h" | |
15 | #include "options/cf_options.h" | |
16 | #include "table/block_based_table_reader.h" | |
17 | ||
18 | namespace rocksdb { | |
19 | ||
20 | struct ColDeclaration; | |
21 | struct KVPairColDeclarations; | |
22 | ||
23 | class ColumnAwareEncodingReader { | |
24 | public: | |
25 | explicit ColumnAwareEncodingReader(const std::string& file_name); | |
26 | ||
27 | void GetKVPairsFromDataBlocks(std::vector<KVPairBlock>* kv_pair_blocks); | |
28 | ||
29 | void EncodeBlocksToRowFormat(WritableFile* out_file, | |
30 | CompressionType compression_type, | |
31 | const std::vector<KVPairBlock>& kv_pair_blocks, | |
32 | std::vector<std::string>* blocks); | |
33 | ||
34 | void DecodeBlocksFromRowFormat(WritableFile* out_file, | |
35 | const std::vector<std::string>* blocks); | |
36 | ||
37 | void DumpDataColumns(const std::string& filename, | |
38 | const KVPairColDeclarations& kvp_col_declarations, | |
39 | const std::vector<KVPairBlock>& kv_pair_blocks); | |
40 | ||
41 | Status EncodeBlocks(const KVPairColDeclarations& kvp_col_declarations, | |
42 | WritableFile* out_file, CompressionType compression_type, | |
43 | const std::vector<KVPairBlock>& kv_pair_blocks, | |
44 | std::vector<std::string>* blocks, bool print_column_stat); | |
45 | ||
46 | void DecodeBlocks(const KVPairColDeclarations& kvp_col_declarations, | |
47 | WritableFile* out_file, | |
48 | const std::vector<std::string>* blocks); | |
49 | ||
50 | static void GetColDeclarationsPrimary( | |
51 | std::vector<ColDeclaration>** key_col_declarations, | |
52 | std::vector<ColDeclaration>** value_col_declarations, | |
53 | ColDeclaration** value_checksum_declaration); | |
54 | ||
55 | static void GetColDeclarationsSecondary( | |
56 | std::vector<ColDeclaration>** key_col_declarations, | |
57 | std::vector<ColDeclaration>** value_col_declarations, | |
58 | ColDeclaration** value_checksum_declaration); | |
59 | ||
60 | private: | |
61 | // Init the TableReader for the sst file | |
62 | void InitTableReader(const std::string& file_path); | |
63 | ||
64 | std::string file_name_; | |
65 | EnvOptions soptions_; | |
66 | ||
67 | Options options_; | |
68 | ||
69 | Status init_result_; | |
70 | std::unique_ptr<BlockBasedTable> table_reader_; | |
71 | std::unique_ptr<RandomAccessFileReader> file_; | |
72 | ||
73 | const ImmutableCFOptions ioptions_; | |
11fdf7f2 | 74 | const MutableCFOptions moptions_; |
7c673cae FG |
75 | InternalKeyComparator internal_comparator_; |
76 | std::unique_ptr<TableProperties> table_properties_; | |
77 | }; | |
78 | ||
79 | } // namespace rocksdb | |
80 | ||
81 | #endif // ROCKSDB_LITE |