0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
IntervalScannerAsync.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 
22 #ifndef Hypertable_Lib_intervalScannerAsync_h
23 #define Hypertable_Lib_intervalScannerAsync_h
24 
32 
33 #include <Common/Properties.h>
34 #include <Common/StringExt.h>
35 
36 #include <memory>
37 #include <mutex>
38 
39 namespace Hypertable {
40 
41  using namespace Lib;
42 
43  class Table;
44  class TableScannerAsync;
45 
47 
48  public:
64  RangeLocatorPtr &range_locator,
65  const ScanSpec &scan_spec, uint32_t timeout_ms,
66  bool current, TableScannerAsync *scanner, int id);
67 
68  virtual ~IntervalScannerAsync();
69 
70  bool abort(bool is_create);
71  // if we can't retry then abort scanner
72  bool retry_or_abort(bool refresh, bool hard, bool is_create,
73  bool *move_to_next, int last_error);
74  bool handle_result(bool *show_results, ScanCellsPtr &cells, EventPtr &event, bool is_create);
75  bool set_current(bool *show_results, ScanCellsPtr &cells, bool abort);
76  inline bool has_outstanding_requests() { return m_create_outstanding || m_fetch_outstanding; }
77  int64_t bytes_scanned() { return m_bytes_scanned; }
78  bool is_destroyed_scanner(bool is_create);
79 
82  ProfileDataScanner &profile_data() { return m_profile_data; }
83 
84  private:
85  void reset_outstanding_status(bool is_create, bool reset_timer);
86  void readahead();
87  void init(const ScanSpec &);
88  void find_range_and_start_scan(const char *row_key, bool hard=false);
89  void set_result(EventPtr &event, ScanCellsPtr &cells, bool is_create=false);
90  void load_result(ScanCellsPtr &cells);
91  void set_range_spec(DynamicBuffer &dbuf, RangeSpec &range);
92  void restart_scan(bool refresh=false);
93 
104  bool m_eos;
105  std::string m_create_scanner_row;
111  std::string m_start_row;
112  std::string m_end_row;
114  uint32_t m_timeout_ms;
115  bool m_current;
124  int m_state;
129  bool m_defer_readahead {};
130  };
131 
133  typedef std::shared_ptr<IntervalScannerAsync> IntervalScannerAsyncPtr;
134 
135 }
136 
137 #endif // Hypertable_Lib_intervalScannerAsync_h
Range specification.
Definition: RangeSpec.h:40
std::shared_ptr< RangeLocator > RangeLocatorPtr
Smart pointer to RangeLocator.
Definition: RangeLocator.h:198
Asynchronous table scanner.
void init(int argc, char *argv[], const Desc *desc=NULL)
Initialize with default policy.
Definition: Init.h:95
Declarations for TableIdentifier and TableIdentifierManaged.
ProfileDataScanner m_profile_data
Accumulated profile data.
Program options handling.
Holds range start and end row plus location.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
Definition: Event.h:228
TableIdentifierManaged m_table_identifier
std::shared_ptr< IntervalScannerAsync > IntervalScannerAsyncPtr
Smart pointer to IntervalScannerAsync.
Declarations for RangeServerClient.
A dynamic, resizable and reference counted memory buffer.
Definition: DynamicBuffer.h:42
std::shared_ptr< LocationCache > LocationCachePtr
Smart pointer to LocationCache.
Wrapper for TableIdentifier providing member storage.
Scan predicate and control specification.
Definition: ScanSpec.h:56
Represents an open table.
Definition: Table.h:58
std::shared_ptr< ScanCells > ScanCellsPtr
Smart pointer to ScanCells.
Definition: ScanCells.h:143
std::set< const char *, LtCstr > CstrSet
STL Set managing c-style strings.
Definition: StringExt.h:52
Declarations for ProfileDataScanner.
Lib::RangeServer::Client m_range_server
std::shared_ptr< ApplicationQueueInterface > ApplicationQueueInterfacePtr
Smart pointer to ApplicationQueueInterface.
Helper class for building a ScanSpec.
Definition: ScanSpec.h:318
Hypertable definitions
Entry point to AsyncComm service.
Definition: Comm.h:61
Tracks row and cell limits used to enforce scan limit predicates.
Provides access to internal components of opaque key.
Definition: Key.h:40
Client interface to RangeServer.
Definition: Client.h:63
TableScannerDispatchHandler m_fetch_handler
A timer class to keep timeout states across AsyncComm related calls.
Definition: Timer.h:44
Declarations for ScanBlock.
ProfileDataScanner & profile_data()
Returns reference to profile data.
TableScannerDispatchHandler m_create_handler
std::shared_ptr< Schema > SchemaPtr
Smart pointer to Schema.
Definition: Schema.h:465
String extensions and helpers: sets, maps, append operators etc.