0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TableMutatorSyncDispatchHandler.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_Lib_TableMutatorSyncDispatchHandler_h
28 #define Hypertable_Lib_TableMutatorSyncDispatchHandler_h
29 
31 
32 #include <AsyncComm/Comm.h>
33 #include <AsyncComm/CommAddress.h>
35 #include <AsyncComm/Event.h>
36 
37 #include <Common/InetAddr.h>
38 #include <Common/StringExt.h>
39 
40 #include <condition_variable>
41 #include <mutex>
42 
43 namespace Hypertable {
44 
45  using namespace Lib;
46  using namespace std;
47 
53 
54  public:
55 
56 
57  struct ErrorResult {
59  int error;
60  std::string msg;
61  };
62 
66  TableMutatorSyncDispatchHandler(Comm *comm, TableIdentifierManaged &table_id, time_t timeout);
67 
72 
76  void add(const CommAddress &addr);
77 
85  virtual void handle(EventPtr &event_ptr);
86 
87  bool wait_for_completion();
88  void retry();
89  void get_errors(vector<ErrorResult> &errors);
90 
91  private:
93  std::condition_variable m_cond;
94  int m_outstanding {};
96  vector<ErrorResult> m_errors;
99  };
100 }
101 
102 
103 #endif // Hypertable_Lib_TableMutatorSyncDispatchHandler_h
static std::mutex mutex
Definition: Logger.cc:43
Abstract base class for application dispatch handlers registered with AsyncComm.
std::vector< String > errors
Declarations for CommAddress.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
Definition: Event.h:228
STL namespace.
Declarations for RangeServerClient.
void add(const Key &key, uint8_t flag, const void *value, uint32_t value_len, TableMutatorAsync *value_index_mutator, TableMutatorAsync *qualifier_index_mutator)
Definition: IndexTables.cc:34
Declarations for Event.
Wrapper for TableIdentifier providing member storage.
Declarations for DispatchHandler.
Hypertable definitions
std::set< CommAddress > CommAddressSet
Set of CommAddress objects.
Definition: CommAddress.h:212
This class is a DispatchHandler class that is used for collecting asynchronous commit log sync reques...
Entry point to AsyncComm service.
Definition: Comm.h:61
Declarations for Comm.
Client interface to RangeServer.
Definition: Client.h:63
Internet address wrapper classes and utility functions.
String extensions and helpers: sets, maps, append operators etc.
Address abstraction to hold either proxy name or IPv4:port address.
Definition: CommAddress.h:52