InfiniSQL  v0.1.2-alpha
Massive Scale Transaction Processing
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Message Class Reference

create Message object More...

#include <Message.h>

Inheritance diagram for Message:
Collaboration diagram for Message:

Classes

struct  message_s
 Message POD (serializable by memcpy) data members. More...
 

Public Member Functions

 Message ()
 
virtual ~Message ()
 
size_t size ()
 get Message size More...
 
std::string * ser ()
 create string with serialized message More...
 
void package (class SerializedMessage &serobj)
 serialize this More...
 
void unpack (SerializedMessage &serobj)
 deserialize into this More...
 
void clear ()
 clear contents of this More...
 
string * sermsg ()
 return serialized Message variant string More...
 
void setEnvelope (const Topology::addressStruct &source, const Topology::addressStruct &dest, class Message &msg)
 put addresses in Message variant envelope More...
 

Static Public Member Functions

static class Messagedes (string *serstr)
 deserialize entire message More...
 

Public Attributes

__int128 nextmsg
 
message_s messageStruct
 

Detailed Description

create Message object

Returns

Definition at line 85 of file Message.h.

Constructor & Destructor Documentation

Message::Message ( )

Definition at line 33 of file Message.cc.

34 {
35 }
Message::~Message ( )
virtual

Definition at line 37 of file Message.cc.

38 {
39 }

Member Function Documentation

void Message::clear ( )

clear contents of this

Definition at line 68 of file Message.cc.

References messageStruct.

Referenced by MessageSocket::clear(), MessageUserSchema::clear(), MessageDeadlock::clear(), MessageTransaction::clear(), MessageDispatch::clear(), MessageAckDispatch::clear(), MessageApply::clear(), and MessageAckApply::clear().

69 {
70  messageStruct={};
71 }

Here is the caller graph for this function:

class Message * Message::des ( string *  serstr)
static

deserialize entire message

Parameters
serstrstring of serialized message
Returns
deserialized message

Definition at line 73 of file Message.cc.

References SerializedMessage::getpayloadtype(), PAYLOADACKAPPLY, PAYLOADACKDISPATCH, PAYLOADAPPLY, PAYLOADCOMMITROLLBACK, PAYLOADDEADLOCK, PAYLOADDISPATCH, PAYLOADMESSAGE, PAYLOADSOCKET, PAYLOADSUBTRANSACTION, Message::message_s::payloadtype, PAYLOADUSERSCHEMA, unpack(), MessageSocket::unpack(), MessageUserSchema::unpack(), MessageDeadlock::unpack(), MessageSubtransactionCmd::unpack(), MessageCommitRollback::unpack(), MessageDispatch::unpack(), MessageAckDispatch::unpack(), MessageApply::unpack(), and MessageAckApply::unpack().

74 {
75  message_s tmpheader;
76  memcpy(&tmpheader, &serstr->at(0), sizeof(tmpheader));
77 
78  class Message *msg;
79  class SerializedMessage serobj(serstr);
80  switch(serobj.getpayloadtype())
81  {
82  case PAYLOADMESSAGE:
83  msg = (class Message *)new class Message;
84  msg->unpack(serobj);
85  break;
86 
87  case PAYLOADSOCKET:
88  msg = (class Message *)new class MessageSocket;
89  ((class MessageSocket *)msg)->unpack(serobj);
90  break;
91 
92  case PAYLOADUSERSCHEMA:
93  msg = (class Message *)new class MessageUserSchema;
94  ((class MessageUserSchema *)msg)->unpack(serobj);
95  break;
96 
97  case PAYLOADDEADLOCK:
98  msg = (class Message *)new class MessageDeadlock;
99  ((class MessageDeadlock *)msg)->unpack(serobj);
100  break;
101 
103  msg = (class Message *)new class MessageSubtransactionCmd;
104  ((class MessageSubtransactionCmd *)msg)->unpack(serobj);
105  break;
106 
108  msg = (class Message *)new class MessageCommitRollback;
109  ((class MessageCommitRollback *)msg)->unpack(serobj);
110  break;
111 
112  case PAYLOADDISPATCH:
113  msg = (class Message *)new class MessageDispatch;
114  ((class MessageDispatch *)msg)->unpack(serobj);
115  break;
116 
117  case PAYLOADACKDISPATCH:
118  msg = (class Message *)new class MessageAckDispatch;
119  ((class MessageAckDispatch *)msg)->unpack(serobj);
120  break;
121 
122  case PAYLOADAPPLY:
123  msg = (class Message *)new class MessageApply;
124  ((class MessageApply *)msg)->unpack(serobj);
125  break;
126 
127  case PAYLOADACKAPPLY:
128  msg = (class Message *)new class MessageAckApply;
129  ((class MessageAckApply *)msg)->unpack(serobj);
130  break;
131 
132  default:
133  printf("%s %i anomaly %i\n", __FILE__, __LINE__, tmpheader.payloadtype);
134  delete serstr;
135  return NULL;
136  }
137 
138  delete serstr;
139  return msg;
140 }

Here is the call graph for this function:

void Message::package ( class SerializedMessage serobj)

serialize this

Parameters
serobjSerializedMessage

Definition at line 58 of file Message.cc.

References messageStruct, and SerializedMessage::ser().

Referenced by MessageSocket::package(), MessageUserSchema::package(), MessageDeadlock::package(), MessageTransaction::package(), MessageDispatch::package(), MessageAckDispatch::package(), MessageApply::package(), MessageAckApply::package(), and ser().

59 {
60  serobj.ser(messageStruct);
61 }

Here is the call graph for this function:

Here is the caller graph for this function:

string * Message::ser ( )

create string with serialized message

Returns
serialized message string

Definition at line 46 of file Message.cc.

References SerializedMessage::data, SerializedMessage::getpayloadtype(), logfile, package(), and SerializedMessage::pos.

47 {
48  class SerializedMessage serobj(size());
49  package(serobj);
50  if (serobj.data->size() != serobj.pos)
51  {
52  fprintf(logfile, "%s %i ser %i size %lu pos %lu\n", __FILE__, __LINE__,
53  serobj.getpayloadtype(), serobj.data->size(), serobj.pos);
54  }
55  return serobj.data;
56 }

Here is the call graph for this function:

string * Message::sermsg ( )

return serialized Message variant string

Returns
serialized Message variant string

Definition at line 142 of file Message.cc.

References messageStruct, PAYLOADACKAPPLY, PAYLOADACKDISPATCH, PAYLOADAPPLY, PAYLOADCOMMITROLLBACK, PAYLOADDEADLOCK, PAYLOADDISPATCH, PAYLOADMESSAGE, PAYLOADSOCKET, PAYLOADSUBTRANSACTION, Message::message_s::payloadtype, and PAYLOADUSERSCHEMA.

Referenced by MboxProducer::sendMsg().

143 {
144  string *serstr;
145 
146  switch (messageStruct.payloadtype)
147  {
148  case PAYLOADMESSAGE:
149  serstr=((class Message *)this)->ser();
150  break;
151 
152  case PAYLOADSOCKET:
153  serstr=((class MessageSocket *)this)->ser();
154  break;
155 
156  case PAYLOADUSERSCHEMA:
157  serstr=((class MessageUserSchema *)this)->ser();
158  break;
159 
160  case PAYLOADDEADLOCK:
161  serstr=((class MessageDeadlock *)this)->ser();
162  break;
163 
165  serstr=((class MessageSubtransactionCmd *)this)->ser();
166  break;
167 
169  serstr=((class MessageCommitRollback *)this)->ser();
170  break;
171 
172  case PAYLOADDISPATCH:
173  serstr=((class MessageDispatch *)this)->ser();
174  break;
175 
176  case PAYLOADACKDISPATCH:
177  serstr=((class MessageAckDispatch *)this)->ser();
178  break;
179 
180  case PAYLOADAPPLY:
181  serstr=((class MessageApply *)this)->ser();
182  break;
183 
184  case PAYLOADACKAPPLY:
185  serstr=((class MessageAckApply *)this)->ser();
186  break;
187 
188  default:
189  printf("%s %i anomaly %i\n", __FILE__, __LINE__,
191  serstr=NULL;
192  }
193 
194  return serstr;
195 }

Here is the caller graph for this function:

void Message::setEnvelope ( const Topology::addressStruct source,
const Topology::addressStruct dest,
class Message msg 
)

put addresses in Message variant envelope

Parameters
sourcesource address
destdestination address
msgMessage

Definition at line 197 of file Message.cc.

References Message::message_s::destAddr, messageStruct, and Message::message_s::sourceAddr.

Referenced by Mboxes::toActor(), and Mboxes::toPartition().

200 {
201  msg.messageStruct.sourceAddr = source;
202  msg.messageStruct.destAddr = dest;
203 }

Here is the caller graph for this function:

size_t Message::size ( )

get Message size

Returns
size in bytes

Definition at line 41 of file Message.cc.

References messageStruct, and SerializedMessage::sersize().

Referenced by ObGateway::ObGateway(), MessageSocket::size(), MessageUserSchema::size(), MessageDeadlock::size(), MessageTransaction::size(), MessageDispatch::size(), MessageAckDispatch::size(), MessageApply::size(), and MessageAckApply::size().

42 {
44 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Message::unpack ( SerializedMessage serobj)

deserialize into this

Parameters
serobjSerializedMessage

Definition at line 63 of file Message.cc.

References SerializedMessage::des(), and messageStruct.

Referenced by des(), MessageSocket::unpack(), MessageUserSchema::unpack(), MessageDeadlock::unpack(), MessageTransaction::unpack(), MessageDispatch::unpack(), MessageAckDispatch::unpack(), MessageApply::unpack(), and MessageAckApply::unpack().

64 {
65  serobj.des(messageStruct);
66 }

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

message_s Message::messageStruct

Definition at line 158 of file Message.h.

Referenced by Transaction::abortCmd(), Engine::addcolumn(), UserSchemaMgr::addcolumn(), TransactionAgent::addcolumn(), Engine::apply(), Engine::background(), TopologyMgr::broadcastConfig(), UserSchemaMgr::changepassword(), TransactionAgent::changepassword(), Transaction::checkLock(), Transaction::checkSqlLock(), clear(), TransactionAgent::compile(), Transaction::continueCommitTransaction(), UserSchemaMgr::createdomain(), TransactionAgent::createdomain(), Engine::createschema(), UserSchemaMgr::createschema(), Engine::createtable(), UserSchemaMgr::createtable(), TransactionAgent::createtable(), UserSchemaMgr::createuser(), TransactionAgent::createuser(), DeadlockMgr::deadlock(), DeadlockMgr::DeadlockMgr(), UserSchemaMgr::deletedomain(), TransactionAgent::deletedomain(), Engine::deleteindex(), UserSchemaMgr::deleteindex(), Engine::deleteschema(), UserSchemaMgr::deleteschema(), Engine::deletetable(), UserSchemaMgr::deletetable(), UserSchemaMgr::deleteuser(), TransactionAgent::deleteuser(), SubTransaction::drainIndexLockQueue(), SubTransaction::drainRowLockQueue(), Engine::Engine(), TransactionAgent::handledispatch(), IbGateway::inbufhandler(), UserSchemaMgr::login(), TransactionAgent::login(), Mbox::Mbox(), MessageBatchSerialized::MessageBatchSerialized(), MessageDeadlock::MessageDeadlock(), MessageDispatch::MessageDispatch(), MessageSerialized::MessageSerialized(), MessageUserSchema::MessageUserSchema(), TransactionAgent::newprocedure(), ObGateway::ObGateway(), UserSchemaMgr::operationHandler(), package(), SubTransaction::processTransactionMessage(), replyTa(), SubTransaction::replyTransaction(), Transaction::rollback(), TransactionAgent::schemaBoilerplate(), MboxProducer::sendMsg(), Transaction::sendTransaction(), sermsg(), setEnvelope(), size(), TransactionAgent::TAaddcolumn(), TransactionAgent::TAcreateschema(), TransactionAgent::TAcreatetable(), TransactionAgent::TAdeleteindex(), TransactionAgent::TAdeleteschema(), TransactionAgent::TAdeletetable(), Mboxes::toAllOfType(), Mboxes::toAllOfTypeThisReplica(), TransactionAgent::TransactionAgent(), unpack(), MessageSocket::unpack(), UserSchemaMgr::UserSchemaMgr(), and TransactionAgent::usmReply().

__int128 Message::nextmsg

The documentation for this class was generated from the following files: