0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LocationInitializer.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.
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_LocationInitializer_h
28 #define Hypertable_RangeServer_LocationInitializer_h
29 
31 
33 
34 #include <Hyperspace/Session.h>
35 
37 
38 #include <Common/String.h>
39 
40 #include <condition_variable>
41 #include <mutex>
42 
43 namespace Hypertable {
44 
45  using namespace Lib;
46 
49 
52 
53  public:
54 
57  LocationInitializer(std::shared_ptr<Context> &context);
58 
60  virtual bool is_removed(const String &path,
61  Hyperspace::SessionPtr &hyperspace);
62 
63  CommBuf *create_initialization_request() override;
64  bool process_initialization_response(Event *event) override;
66 
68  String get();
69 
71  void wait_for_handshake();
72 
74  void set_lock_held() { m_lock_held=true; }
75 
76  private:
77 
79  std::shared_ptr<Context> m_context;
80 
83 
85  std::condition_variable m_cond;
86 
89 
92 
94  bool m_location_persisted {};
95 
97  bool m_handshake_complete {};
98 
100  bool m_lock_held {};
101  };
102 
104  typedef std::shared_ptr<LocationInitializer> LocationInitializerPtr;
105 
107 }
108 
109 
110 #endif // Hypertable_RangeServer_LocationInitializer_h
static std::mutex mutex
Definition: Logger.cc:43
Network communication event.
Definition: Event.h:54
String m_location_file
Local pathname to location file.
std::shared_ptr< LocationInitializer > LocationInitializerPtr
Shared smart pointer to LocationInitializer.
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
Declarations for ConnectionInitializer.
Declarations for Context.
std::condition_variable m_cond
Condition variable signalling completion of initialization handshake.
Declarations for RangeServerProtocol.
std::shared_ptr< Session > SessionPtr
Definition: Session.h:734
String m_location
Assigned location (proxy name)
uint64_t initialization_command() override
Command code (see CommHeader::command) for initialization response message.
Hypertable definitions
Driver interface for connection initialization handshake in ConnectionManager.
std::mutex m_mutex
Mutex for serializing concurrent access.
Message buffer for holding data to be transmitted over a network.
Definition: CommBuf.h:79
A String class based on std::string.
Obtains location string (proxy name) for the range server.
void set_lock_held()
Signals that Hyperspace lock on location file is held.
std::shared_ptr< Context > m_context
Range server context