0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MergeScannerRange.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
26 
27 #ifndef Hypertable_RangeServer_MergeScannerRange_h
28 #define Hypertable_RangeServer_MergeScannerRange_h
29 
32 
33 #include <Common/ByteString.h>
34 #include <Common/DynamicBuffer.h>
35 
36 #include <memory>
37 #include <queue>
38 #include <set>
39 #include <string>
40 #include <vector>
41 
42 namespace Hypertable {
43 
46 
49 
50  public:
51  MergeScannerRange(const std::string &table_id, ScanContextPtr &scan_ctx);
52 
55  virtual ~MergeScannerRange();
56 
58  m_scanners.push_back(scanner);
59  }
60 
61  void forward();
62 
63  bool get(Key &key, ByteString &value);
64 
65  int32_t get_skipped_cells() { return m_cell_skipped; }
66 
67  int32_t get_skipped_rows() { return m_row_skipped; }
68 
73  int64_t get_input_cells();
74 
78  int64_t get_output_cells() { return m_cells_output; }
79 
84  int64_t get_input_bytes();
85 
89  int64_t get_output_bytes() { return m_bytes_output; }
90 
91  int64_t get_disk_read();
92 
94 
95  private:
96 
97  void initialize();
98 
99  struct ScannerState {
103  };
104 
105  struct LtScannerState {
106  bool operator()(const ScannerState &ss1, const ScannerState &ss2) const {
107  return ss1.key.serial > ss2.key.serial;
108  }
109  };
110 
111  std::vector<MergeScannerAccessGroup *> m_scanners;
112  std::priority_queue<ScannerState, std::vector<ScannerState>,
114 
117 
120 
122  bool m_done {};
123 
125  bool m_initialized {};
126 
128 
129  int32_t m_cell_offset {};
130  int32_t m_cell_skipped {};
131  int32_t m_cell_count {};
132  int32_t m_cell_limit {};
133  int32_t m_row_offset {};
134  int32_t m_row_skipped {};
135  int32_t m_row_count {};
136  int32_t m_row_limit {};
139  int32_t m_prev_cf {-1};
141  int64_t m_bytes_output {};
142  int64_t m_cells_output {};
144 
145  };
146 
148  typedef std::shared_ptr<MergeScannerRange> MergeScannerRangePtr;
149 
151 
152 } // namespace Hypertable
153 
154 #endif // Hypertable_RangeServer_MergeScannerRange_h
bool m_initialized
Flag indicating if scan has been initialized.
Declarations for MergeScannerAccessGroup.
std::shared_ptr< IndexUpdater > IndexUpdaterPtr
Smart pointer to IndexUpdater.
Definition: IndexUpdater.h:87
Scan context information.
Definition: ScanContext.h:52
IndexUpdaterPtr m_index_updater
Index updater for rebuild indices scan.
A dynamic, resizable and reference counted memory buffer.
Definition: DynamicBuffer.h:42
A class managing one or more serializable ByteStrings.
Definition: ByteString.h:47
std::priority_queue< ScannerState, std::vector< ScannerState >, LtScannerState > m_queue
bool m_done
Flag indicating scan is finished.
int64_t get_output_bytes()
Returns number of bytes output.
A dynamic, resizable memory buffer.
std::shared_ptr< MergeScannerRange > MergeScannerRangePtr
Smart pointer to MergeScannerRange.
static const int64_t TIMESTAMP_NULL
Definition: KeySpec.h:36
int64_t get_output_cells()
Returns number of cells output.
Declarations for IndexUpdater.
void add_scanner(MergeScannerAccessGroup *scanner)
int64_t get_input_bytes()
Returns number of bytes input.
MergeScannerRange(const std::string &table_id, ScanContextPtr &scan_ctx)
Hypertable definitions
SerializedKey serial
Definition: Key.h:123
ScanContextPtr m_scan_context
Scan context.
bool operator()(const ScannerState &ss1, const ScannerState &ss2) const
std::vector< MergeScannerAccessGroup * > m_scanners
int64_t get_input_cells()
Returns number of cells input.
Provides access to internal components of opaque key.
Definition: Key.h:40
A serializable ByteString.
Performs a scan over a range.
virtual ~MergeScannerRange()
Destructor.
std::shared_ptr< ScanContext > ScanContextPtr
Definition: ScanContext.h:169
Merge scanner for access groups.