18 #ifndef TransporterFacade_H
19 #define TransporterFacade_H
21 #include <kernel_types.h>
22 #include <ndb_limits.h>
23 #include <NdbThread.h>
24 #include <TransporterRegistry.hpp>
26 #include "DictCache.hpp"
27 #include <BlockNumbers.h>
40 void* runSendRequest_C(
void*);
41 void* runReceiveResponse_C(
void*);
72 Uint32 get_active_ndb_objects()
const;
76 int sendSignal(
const NdbApiSignal * signal, NodeId nodeId);
91 void ext_update_connections();
92 struct in_addr ext_get_connect_address(Uint32 nodeId);
94 bool ext_isConnected(NodeId aNodeId);
95 void ext_doConnect(
int aNodeId);
99 bool get_node_alive(NodeId nodeId)
const;
100 bool getIsNodeSendable(NodeId nodeId)
const;
103 Uint32 getMinDbNodeVersion()
const;
106 NodeId ownId()
const;
110 void doConnect(
int NodeId);
111 void reportConnected(
int NodeId);
112 void doDisconnect(
int NodeId);
113 void reportDisconnected(
int NodeId);
115 NodeId get_an_alive_node();
116 void trp_node_status(NodeId, Uint32
event);
128 void forceSend(Uint32 block_number);
129 void checkForceSend(Uint32 block_number);
150 void do_poll(
trp_client* clnt, Uint32 wait_time);
154 void external_poll(Uint32 wait_time);
156 trp_client* get_poll_owner(
bool)
const {
return m_poll_owner;}
159 void remove_from_poll_queue(
trp_client* clnt);
167 void hb_received(NodeId
n);
168 void set_auto_reconnect(
int val);
169 int get_auto_reconnect()
const;
174 Uint32 *
const signalData,
177 void reportSendLen(NodeId nodeId, Uint32 count, Uint64 bytes);
181 void reportError(NodeId nodeId, TransporterError errorCode,
182 const char *info = 0);
186 return theTransporterRegistry->get_bytes_to_send_iovec(node, dst, max);
190 return theTransporterRegistry->bytes_sent(node, bytes);
194 return theTransporterRegistry->has_data_to_send(node);
198 theTransporterRegistry->reset_send_buffer(node, should_be_empty);
209 bool isConnected(NodeId aNodeId);
214 int sendPerformedLastInterval;
216 NodeId theStartNodeId;
222 Uint32 currentSendLimit;
224 void calculateSendLimit();
229 void threadMainSend(
void);
231 void threadMainReceive(
void);
234 friend void* runSendRequest_C(
void*);
235 friend void* runReceiveResponse_C(
void*);
257 int close(
int number);
258 void expand(Uint32
size);
260 inline trp_client*
get(Uint16 blockNo)
const {
261 blockNo -= MIN_API_BLOCK_NO;
262 if(likely (blockNo < m_objectExecute.size()))
264 return m_objectExecute.getBase()[blockNo];
270 Uint32 m_fixed2dynamic[NO_API_FIXED_BLOCKS];
271 Uint32 m_fragmented_signal_id;
274 NdbMutex* theMutexPtr;
282 TransporterFacade::lock_mutex()
284 NdbMutex_Lock(theMutexPtr);
289 TransporterFacade::unlock_mutex()
291 NdbMutex_Unlock(theMutexPtr);
294 #include "ClusterMgr.hpp"
295 #include "ndb_cluster_connection_impl.hpp"
298 unsigned Ndb_cluster_connection_impl::get_connect_count()
const
300 if (m_transporter_facade->theClusterMgr)
301 return m_transporter_facade->theClusterMgr->m_connect_count;
306 unsigned Ndb_cluster_connection_impl::get_min_db_version()
const
308 return m_transporter_facade->getMinDbNodeVersion();
313 TransporterFacade::get_node_alive(NodeId n)
const {
316 return theClusterMgr->getNodeInfo(n).m_alive;
323 TransporterFacade::hb_received(NodeId n) {
324 theClusterMgr->hb_received(n);
329 TransporterFacade::getMinDbNodeVersion()
const
332 return theClusterMgr->minDbVersion;
339 trp_client::getNodeInfo(Uint32 nodeId)
const
341 return m_facade->theClusterMgr->getNodeInfo(nodeId);
362 data= (_len == 0)? NULL:_data;
376 const Uint32* getNextWords(Uint32& sz)
408 firstSignal= currentSignal= signal;
417 currentSignal= firstSignal;
420 const Uint32* getNextWords(Uint32& sz);
433 const Uint32* chunkPtr;
443 void copyNWords(Uint32* dest, Uint32 n)
447 if (chunkRemain == 0)
452 chunkPtr = gsi->getNextWords(chunkRemain);
461 Uint32 wordsToCopy = MIN(chunkRemain, n);
462 memcpy(dest, chunkPtr, wordsToCopy << 2);
463 chunkPtr += wordsToCopy;
464 chunkRemain -= wordsToCopy;
476 #endif // TransporterFacade_H