Files
mongo/dbgrid/request.cpp

82 lines
2.0 KiB
C++
Raw Normal View History

2008-11-09 17:49:37 -05:00
/* dbgrid/request.cpp
Top level handling of requests (operations such as query, insert, ...)
*/
2008-09-15 09:14:42 -04:00
/**
* Copyright (C) 2008 10gen Inc.
2008-12-28 20:28:49 -05:00
*
2008-09-15 09:14:42 -04:00
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
2008-12-28 20:28:49 -05:00
*
2008-09-15 09:14:42 -04:00
* 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 Affero General Public License for more details.
2008-12-28 20:28:49 -05:00
*
2008-09-15 09:14:42 -04:00
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2008-10-13 17:58:51 -04:00
/* TODO
2008-11-09 17:49:37 -05:00
_ GridD
2008-10-13 17:58:51 -04:00
_ concurrency control.
_ connection pool
_ hostbyname_nonreentrant() problem
_ gridconfig object which gets config from the grid db.
connect to iad-sb-grid
_ limit() works right?
_ KillCursors
later
_ secondary indexes
*/
2008-09-15 09:14:42 -04:00
#include "stdafx.h"
2009-02-05 11:50:27 -05:00
#include "server.h"
2008-12-05 16:03:35 -05:00
#include "../db/commands.h"
2008-09-29 18:00:53 -04:00
#include "../db/dbmessage.h"
2008-10-31 19:17:54 -05:00
#include "../client/connpool.h"
2008-10-08 18:20:02 -04:00
#include "request.h"
2009-02-05 16:45:58 -05:00
#include "gridconfig.h"
2009-02-06 15:44:21 -05:00
#include "configserver.h"
2009-02-05 16:45:58 -05:00
2009-01-14 17:09:51 -05:00
namespace mongo {
2009-02-06 15:44:21 -05:00
Request::Request( Message& m, MessagingPort& p ) : _m(m) , _d( m ) , _p(p){
assert( _d.getns() );
_id = _m.data->id;
_config = grid.getDBConfig( getns() );
}
void processRequest(Message& m, MessagingPort& p) {
Request r( m , p );
2009-02-05 16:45:58 -05:00
int op = m.data->operation();
assert( op > dbMsg );
2009-02-05 16:45:58 -05:00
2009-02-06 15:44:21 -05:00
Strategy * s = 0;
if ( r.getConfig()->partitioned( r.getns() ) ){
uassert( "partitioned not supported" , 0 );
}
else {
s = SINGLE;
}
2009-02-05 22:25:52 -05:00
if ( op == dbQuery ) {
2009-02-06 15:44:21 -05:00
s->queryOp( r );
}
else if ( op == dbGetMore ) {
2009-02-06 15:44:21 -05:00
s->getMore( r );
}
else {
2009-02-06 15:44:21 -05:00
s->writeOp( op, r );
}
}
2009-02-05 16:45:58 -05:00
2009-01-14 17:09:51 -05:00
} // namespace mongo