Compare commits

...

2 Commits

Author SHA1 Message Date
Dwight
543621e070 v114 merge patch 2008-06-11 17:15:28 -04:00
yellow
131e2eb860 -03 2008-06-08 21:26:01 +00:00
6 changed files with 21 additions and 7 deletions

View File

@@ -152,6 +152,7 @@ void receivedDelete(Message& m) {
}
void receivedQuery(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& ss) {
MSGID responseTo = m.data->id;
DbMessage d(m);
const char *ns = d.getns();
setClient(ns);
@@ -166,7 +167,7 @@ void receivedQuery(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& s
QueryResult* msgdata;
try {
msgdata = runQuery(ns, ntoskip, ntoreturn, query, fields, ss);
msgdata = runQuery(m, ns, ntoskip, ntoreturn, query, fields, ss);
}
catch( AssertionException ) {
ss << " exception ";
@@ -196,7 +197,7 @@ void receivedQuery(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& s
else {
cout << "ERROR: client is null; ns=" << ns << endl;
}
dbMsgPort.reply(m, resp);
dbMsgPort.reply(m, resp, responseTo);
}
void receivedGetMore(AbstractMessagingPort& dbMsgPort, Message& m, stringstream& ss) {
@@ -274,7 +275,7 @@ public:
};
void listen(int port) {
const char *Version = "db version: 112 6jun2008";
const char *Version = "db version: 112.patch114 11jun2008";
problem() << Version << endl;
cout << Version << endl;
pdfileInit();
@@ -290,6 +291,9 @@ extern int callDepth;
class JniMessagingPort : public AbstractMessagingPort {
public:
JniMessagingPort(Message& _container) : container(_container) { }
void reply(Message& received, Message& response, MSGID) {
container = response;
}
void reply(Message& received, Message& response) {
container = response;
}

View File

@@ -1,6 +1,6 @@
# makefile for our db project
FLAGS= ${CFLAGS} -fPIC -ggdb -pthread -O0 -I .. -Isrc/p -I/src/p/db -L/usr/local/lib -L/usr/lib
FLAGS= ${CFLAGS} -fPIC -ggdb -pthread -O3 -I .. -Isrc/p -I/src/p/db -L/usr/local/lib -L/usr/lib
LIB_DEPS = -lpcrecpp -lpcre
LIB_BOOST = -lboost_thread -lboost_filesystem
@@ -69,4 +69,6 @@ info:
@echo 'Using version of GPP :' $(_GPP_VER)
@echo 'Req version of GPP :' $(_REQ_GPP_VER)
@# todo - determine if we have the right version of gcc and error if not
@echo ''
@echo ''

View File

@@ -639,7 +639,7 @@ void killCursors(int n, long long *ids) {
auto_ptr<Cursor> findTableScan(const char *ns, JSObj& order);
QueryResult* runQuery(const char *ns, int ntoskip, int _ntoreturn, JSObj jsobj,
QueryResult* runQuery(Message& message, const char *ns, int ntoskip, int _ntoreturn, JSObj jsobj,
auto_ptr< set<string> > filter, stringstream& ss)
{
bool wantMore = true;
@@ -740,6 +740,7 @@ assert( debug.getN() < 5000 );
ClientCursor::add(cc);
cc->updateLocation();
cc->filter = filter;
cc->originalMessage = message;
}
}
break;

View File

@@ -68,7 +68,7 @@ struct QueryResult : public MsgData {
QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid);
// caller must free() returned QueryResult.
QueryResult* runQuery(const char *ns, int ntoskip, int ntoreturn,
QueryResult* runQuery(Message&, const char *ns, int ntoskip, int ntoreturn,
JSObj j, auto_ptr< set<string> > fieldFilter,
stringstream&);
@@ -102,6 +102,7 @@ public:
int pos;
DiskLoc lastLoc;
auto_ptr< set<string> > filter;
Message originalMessage;
/* report to us that a new clientcursor exists so we can track it. You still
do the initial updateLocation() yourself.

View File

@@ -160,6 +160,10 @@ void MessagingPort::reply(Message& received, Message& response) {
say(received.from, response, received.data->id);
}
void MessagingPort::reply(Message& received, Message& response, MSGID responseTo) {
say(received.from, response, responseTo);
}
bool MessagingPort::call(SockAddr& to, Message& toSend, Message& response) {
mmm( cout << "*call()" << endl; )
MSGID old = toSend.data->id;

View File

@@ -22,6 +22,7 @@ private:
class AbstractMessagingPort {
public:
virtual void reply(Message& received, Message& response,MSGID) = 0;
virtual void reply(Message& received, Message& response) = 0;
};
@@ -40,6 +41,7 @@ public:
*/
bool recv(Message& m);
void reply(Message& received, Message& response);
void reply(Message& received, Message& response, MSGID);
bool call(SockAddr& to, Message& toSend, Message& response);
void say(SockAddr& to, Message& toSend, int responseTo = -1);