Changeset 307
- Timestamp:
- 02/25/08 22:50:31 (9 months ago)
- Location:
- trunk/thrucommon
- Files:
-
- 2 modified
- 2 moved
-
src/Makefile.am (modified) (2 diffs)
-
src/Spread.cpp (moved) (moved from trunk/thrucommon/src/SpreadConnection.cpp) (13 diffs)
-
src/Spread.h (moved) (moved from trunk/thrucommon/src/SpreadConnection.h) (2 diffs)
-
tests/SpreadTest.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thrucommon/src/Makefile.am
r306 r307 17 17 ThruFileTransport.h \ 18 18 RecoveryManager.h \ 19 Spread Connection.h\19 Spread.h \ 20 20 bloom_filter.hpp \ 21 21 utils.h … … 30 30 CircuitBreaker.cpp \ 31 31 ConfigFile.cpp \ 32 ThruFileTransport.cpp \33 32 RecoveryManager.cpp \ 34 SpreadConnection.cpp 33 Spread.cpp \ 34 ThruFileTransport.cpp 35 35 36 36 libthrucommon_la_CPPFLAGS = -Wall -Igen-cpp $(MEMCACHED_CFLAGS) $(SPEAD_CFLAGS) $(SSL_CFLAGS) $(THRIFT_CFLAGS) $(UUID_CFLAGS) -
trunk/thrucommon/src/Spread.cpp
r306 r307 1 1 2 #include "Spread Connection.h"2 #include "Spread.h" 3 3 4 4 using namespace log4cxx; … … 7 7 string SP_error_to_string (int error); 8 8 9 LoggerPtr Spread Connection::logger (Logger::getLogger ("SpreadConnection"));9 LoggerPtr Spread::logger (Logger::getLogger ("Spread")); 10 10 11 11 /* TODO: … … 14 14 */ 15 15 16 Spread Connection::SpreadConnection(const string & name,16 Spread::Spread (const string & name, 17 17 const string & private_name) 18 18 { 19 19 char buf[1024]; 20 sprintf (buf, "Spread Connection: name=%s, private_name=%s",20 sprintf (buf, "Spread: name=%s, private_name=%s", 21 21 name.c_str (), private_name.c_str ()); 22 22 LOG4CXX_INFO (logger, buf); … … 39 39 // save our private group name 40 40 this->private_group = private_group; 41 LOG4CXX_INFO (logger, "Spread Connection: private_group=" +41 LOG4CXX_INFO (logger, "Spread: private_group=" + 42 42 this->private_group); 43 43 } 44 44 45 Spread Connection::~SpreadConnection()46 { 47 LOG4CXX_INFO (logger, "~Spread Connection");45 Spread::~Spread () 46 { 47 LOG4CXX_INFO (logger, "~Spread"); 48 48 map<string, vector<string> >::iterator i; 49 49 for (i = this->groups.begin (); … … 56 56 } 57 57 58 void Spread Connection::join (const std::string & group)58 void Spread::join (const std::string & group) 59 59 { 60 60 LOG4CXX_DEBUG (logger, "join: group=" + group); … … 82 82 } 83 83 84 void Spread Connection::leave (const std::string & group)84 void Spread::leave (const std::string & group) 85 85 { 86 86 LOG4CXX_DEBUG (logger, "leave: group=" + group); … … 95 95 } 96 96 97 void Spread Connection::subscribe (const string & sender, const string & group,97 void Spread::subscribe (const string & sender, const string & group, 98 98 const int message_type, 99 99 SubscriberCallbackInfo * callback) … … 112 112 } 113 113 114 void Spread Connection::send (const service service_type, const string & group,114 void Spread::send (const service service_type, const string & group, 115 115 const int message_type, const char * message, 116 116 const int message_len) … … 128 128 129 129 // message will be copied in to a local buffer 130 void Spread Connection::queue (const service service_type, const string & group,130 void Spread::queue (const service service_type, const string & group, 131 131 const int message_type, const char * message, 132 132 const int message_len) … … 149 149 } 150 150 151 void Spread Connection::run (int count)151 void Spread::run (int count) 152 152 { 153 153 if (logger->isDebugEnabled ()) … … 231 231 } 232 232 233 void Spread Connection::make_callbacks233 void Spread::make_callbacks 234 234 (vector<SubscriberCallbackInfo *> & callbacks, const string & sender, 235 235 const vector<string> & groups, const int message_type, const char * message, … … 269 269 } 270 270 271 void Spread Connection::dispatch (const string & sender,271 void Spread::dispatch (const string & sender, 272 272 const vector<string> & groups, 273 273 const int message_type, const char * message, … … 404 404 } 405 405 406 void Spread Connection::drain_pending ()406 void Spread::drain_pending () 407 407 { 408 408 if (logger->isDebugEnabled ()) -
trunk/thrucommon/src/Spread.h
r305 r307 28 28 29 29 // only so we can pass this in to callbacks 30 class Spread Connection;30 class Spread; 31 31 /* callbacks return true to stay installed, false to be removed */ 32 typedef bool (*subscriber_callback) (Spread Connection* spread_connection,32 typedef bool (*subscriber_callback) (Spread * spread_connection, 33 33 const std::string & sender, 34 34 const std::vector<std::string> & groups, … … 53 53 }; 54 54 55 class Spread Connection55 class Spread 56 56 { 57 57 public: 58 Spread Connection(const std::string & name,58 Spread (const std::string & name, 59 59 const std::string & private_name); 60 ~Spread Connection();60 ~Spread (); 61 61 62 62 void subscribe (const std::string & sender, const std::string & group, -
trunk/thrucommon/tests/SpreadTest.cpp
r305 r307 9 9 #if HAVE_CPPUNIT 10 10 11 #include "Spread Connection.h"11 #include "Spread.h" 12 12 13 13 #include <cppunit/CompilerOutputter.h> … … 33 33 { 34 34 string spread_name = "4803@localhost"; 35 SpreadConnection * conn = 36 new SpreadConnection (spread_name, "cppunit"); 37 CPPUNIT_ASSERT (conn); 35 Spread * conn = new Spread (spread_name, "cppunit"); 36 CPPUNIT_ASSERT (conn); 38 37 39 38 string group = "testing"; … … 106 105 107 106 // other sender... 108 SpreadConnection * other_conn = 109 new SpreadConnection (spread_name, "other_cppunit"); 107 Spread * other_conn = new Spread (spread_name, "other_cppunit"); 110 108 other_conn->send (SAFE_MESS, group, 42, msg, msg_len); 111 109 conn->run (1); … … 122 120 }; 123 121 124 static bool all_callback (Spread Connection* /* spread_connection */,122 static bool all_callback (Spread * /* spread_connection */, 125 123 const string & /* sender */, 126 124 const vector<string> & /* groups */, … … 134 132 } 135 133 136 static bool sender_callback (Spread Connection* /* spread_connection */,134 static bool sender_callback (Spread * /* spread_connection */, 137 135 const string & /* sender */, 138 136 const vector<string> & /* groups */, … … 146 144 } 147 145 148 static bool group_callback (Spread Connection* /* spread_connection */,146 static bool group_callback (Spread * /* spread_connection */, 149 147 const string & /* sender */, 150 148 const vector<string> & /* groups */, … … 158 156 } 159 157 160 static bool type_callback (Spread Connection* /* spread_connection */,158 static bool type_callback (Spread * /* spread_connection */, 161 159 const string & /* sender */, 162 160 const vector<string> & /* groups */, … … 170 168 } 171 169 172 static bool once_callback (Spread Connection* /* spread_connection */,170 static bool once_callback (Spread * /* spread_connection */, 173 171 const string & /* sender */, 174 172 const vector<string> & /* groups */,
