summaryrefslogtreecommitdiff
path: root/ndb/src/old_files/rep/transfer/TransSS.hpp
blob: 3340038c8d161a1a6791b9e8c5df1a80198d972c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#ifndef TransSS_HPP
#define TransSS_HPP

#include <NdbTick.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>

#include <TransporterDefinitions.hpp>
#include <TransporterFacade.hpp>
#include <ClusterMgr.hpp>
#include <API.hpp>

#include <rep/storage/GCIContainer.hpp>

#include <rep/SignalQueue.hpp>
#include <rep/ExtSender.hpp>

#include <rep/state/RepState.hpp>

extern "C" {
static void *  signalExecThread_C(void *);
}

/**
 * @class TransSS
 * @brief Responsible for REP-REP interface in Standby System role
 */
class TransSS {
public:
  /***************************************************************************
   * Constructor / Destructor / Init
   ***************************************************************************/
  TransSS(GCIContainer * gciContainer, RepState * repState);
  ~TransSS();
   void init(const char * connectString = NULL);

  /***************************************************************************
   * Public Methods
   ***************************************************************************/
  ExtSender *  getRepSender()                { return m_repSender; };
  TransporterFacade * getTransporterFacade() { return m_transporterFacade; };

private:
  /***************************************************************************
   * Private Methods
   ***************************************************************************/
  friend void *  signalExecThread_C(void *);
  void           signalExecThreadRun();   ///< SignalQueue executor thread

  static void execSignal(void* executorObj, NdbApiSignal* signal, 
			 class LinearSectionPtr ptr[3]);
  static void execNodeStatus(void* executorObj, NodeId, bool alive, 
			     bool nfCompleted);
  
  void sendSignalRep(NdbApiSignal * s);

  /***************************************************************************
   * Signal receivers
   ***************************************************************************/
  void execREP_GET_GCI_REQ(NdbApiSignal*);  
  void execREP_GET_GCI_CONF(NdbApiSignal*);
  void execREP_GET_GCI_REF(NdbApiSignal*);

  void execREP_GET_GCIBUFFER_REQ(NdbApiSignal*);
  void execREP_GET_GCIBUFFER_CONF(NdbApiSignal*);
  void execREP_GET_GCIBUFFER_REF(NdbApiSignal*);

  void execGREP_SUB_REMOVE_CONF(NdbApiSignal *);
  void execGREP_SUB_REMOVE_REF(NdbApiSignal *);

  void execREP_INSERT_GCIBUFFER_REQ(NdbApiSignal*);
  void execREP_INSERT_GCIBUFFER_CONF(NdbApiSignal*);
  void execREP_INSERT_GCIBUFFER_REF(NdbApiSignal*);

  void execREP_DATA_PAGE(NdbApiSignal* signal, LinearSectionPtr ptr[3]);

  void execREP_GCIBUFFER_ACC_REP(NdbApiSignal*);
  void execREP_DISCONNECT_REP(NdbApiSignal*);


  void execREP_CLEAR_PS_GCIBUFFER_CONF(NdbApiSignal*);
  void execREP_CLEAR_PS_GCIBUFFER_REF(NdbApiSignal*);

  void execGREP_SUB_SYNC_CONF(NdbApiSignal*);
  void execGREP_SUB_SYNC_REF(NdbApiSignal*);

  /***************************************************************************
   * Signal receivers : Subscriptions
   ***************************************************************************/
  void execGREP_CREATE_SUBID_CONF(NdbApiSignal*);
  void execGREP_CREATE_SUBID_REF(NdbApiSignal*);
  void execGREP_SUB_CREATE_CONF(NdbApiSignal*);
  void execGREP_SUB_CREATE_REF(NdbApiSignal*);
  void execGREP_SUB_START_CONF(NdbApiSignal*);
  void execGREP_SUB_START_REF(NdbApiSignal*);

  /***************************************************************************
   * Ref signal senders
   ***************************************************************************/

  void sendREP_GET_GCI_REF(NdbApiSignal* signal, Uint32 nodeGrp,
			   Uint32 firstSSGCI, Uint32 lastSSGCI,
			   GrepError::Code err);
  
  void sendREP_GET_GCIBUFFER_REF(NdbApiSignal* signal,
				 Uint32 firstGCI, Uint32 lastGCI,
				 Uint32 nodeGrp, GrepError::Code err);

  /***************************************************************************
   * Private Variables
   ***************************************************************************/
  RepState *              m_repState;

  struct NdbThread *      m_signalExecThread;   ///< Signal Queue executor
  class SignalQueue       m_signalRecvQueue;

  ExtSender *             m_repSender;      ///< Obj responsible send to REP

  Uint32                  m_ownNodeId;      ///< NodeId of this node
  Uint32                  m_ownBlockNo;     ///< BlockNo of this "block"
  BlockReference          m_ownRef;         ///< Reference to this 

  GCIContainer *	  m_gciContainer;       ///< Ref to gci container.

  TransporterFacade *     m_transporterFacade;
};

#endif