connpool.h   connpool.h 
skipping to change at line 98 skipping to change at line 98
} }
scoped_lock L(_mutex); scoped_lock L(_mutex);
_pools[host].pool.push(c); _pools[host].pool.push(c);
} }
void addHook( DBConnectionHook * hook ); void addHook( DBConnectionHook * hook );
void appendInfo( BSONObjBuilder& b ); void appendInfo( BSONObjBuilder& b );
}; };
extern DBConnectionPool pool; extern DBConnectionPool pool;
class AScopedConnection : boost::noncopyable {
public:
virtual ~AScopedConnection(){}
virtual DBClientBase* get() = 0;
virtual void done() = 0;
virtual string getHost() const = 0;
};
/** Use to get a connection from the pool. On exceptions things /** Use to get a connection from the pool. On exceptions things
clean up nicely. clean up nicely.
*/ */
class ScopedDbConnection : boost::noncopyable { class ScopedDbConnection : public AScopedConnection {
const string _host; const string _host;
DBClientBase *_conn; DBClientBase *_conn;
public: public:
/** get the associated connection object */ /** get the associated connection object */
DBClientBase* operator->(){ DBClientBase* operator->(){
uassert( 11004 , "did you call done already" , _conn ); uassert( 11004 , "did you call done already" , _conn );
return _conn; return _conn;
} }
/** get the associated connection object */ /** get the associated connection object */
 End of changes. 2 change blocks. 
1 lines changed or deleted 9 lines changed or added


 dbclientcursor.h   dbclientcursor.h 
skipping to change at line 28 skipping to change at line 28
#pragma once #pragma once
#include "../pch.h" #include "../pch.h"
#include "../util/message.h" #include "../util/message.h"
#include "../db/jsobj.h" #include "../db/jsobj.h"
#include "../db/json.h" #include "../db/json.h"
#include <stack> #include <stack>
namespace mongo { namespace mongo {
class ShardConnection; class AScopedConnection;
/** Queries return a cursor object */ /** Queries return a cursor object */
class DBClientCursor : boost::noncopyable { class DBClientCursor : boost::noncopyable {
public: public:
/** If true, safe to call next(). Requests more from server if necessary. */ /** If true, safe to call next(). Requests more from server if necessary. */
bool more(); bool more();
/** If true, there is more in our local buffers to be fetched via n ext(). Returns /** If true, there is more in our local buffers to be fetched via n ext(). Returns
false when a getMore request back to server would be required. You can use this false when a getMore request back to server would be required. You can use this
if you want to exhaust whatever data has been fetched to the cl ient already but if you want to exhaust whatever data has been fetched to the cl ient already but
skipping to change at line 152 skipping to change at line 152
virtual ~DBClientCursor(); virtual ~DBClientCursor();
long long getCursorId() const { return cursorId; } long long getCursorId() const { return cursorId; }
/** by default we "own" the cursor and will send the server a KillC ursor /** by default we "own" the cursor and will send the server a KillC ursor
message when ~DBClientCursor() is called. This function overrid es that. message when ~DBClientCursor() is called. This function overrid es that.
*/ */
void decouple() { _ownCursor = false; } void decouple() { _ownCursor = false; }
void attach( ScopedDbConnection * conn ); void attach( AScopedConnection * conn );
void attach( ShardConnection * conn );
private: private:
friend class DBClientBase; friend class DBClientBase;
friend class DBClientConnection; friend class DBClientConnection;
bool init(); bool init();
int nextBatchSize(); int nextBatchSize();
DBConnector *connector; DBConnector *connector;
string ns; string ns;
BSONObj query; BSONObj query;
int nToReturn; int nToReturn;
 End of changes. 2 change blocks. 
3 lines changed or deleted 2 lines changed or added


 dbhelpers.h   dbhelpers.h 
skipping to change at line 80 skipping to change at line 80
@param query - the query to perform. note this is the low level portion of query so "orderby : ..." @param query - the query to perform. note this is the low level portion of query so "orderby : ..."
won't work. won't work.
@param requireIndex if true, complain if no index for the query. a way to guard against @param requireIndex if true, complain if no index for the query. a way to guard against
writing a slow query. writing a slow query.
@return true if object found @return true if object found
*/ */
static bool findOne(const char *ns, const BSONObj &query, BSONObj& result, bool requireIndex = false); static bool findOne(const char *ns, const BSONObj &query, BSONObj& result, bool requireIndex = false);
static DiskLoc findOne(const char *ns, const BSONObj &query, bool r equireIndex);
/** /**
* @param foundIndex if passed in will be set to 1 if ns and index found * @param foundIndex if passed in will be set to 1 if ns and index found
* @return true if object found * @return true if object found
*/ */
static bool findById(Client&, const char *ns, BSONObj query, BSONOb j& result , static bool findById(Client&, const char *ns, BSONObj query, BSONOb j& result ,
bool * nsFound = 0 , bool * indexFound = 0 ); bool * nsFound = 0 , bool * indexFound = 0 );
/* uasserts if no _id index.
@return null loc if not found */
static DiskLoc findById(NamespaceDetails *d, BSONObj query);
static auto_ptr<CursorIterator> find( const char *ns , BSONObj quer y = BSONObj() , bool requireIndex = false ); static auto_ptr<CursorIterator> find( const char *ns , BSONObj quer y = BSONObj() , bool requireIndex = false );
/** Get/put the first (or last) object from a collection. Generall y only useful if the collection /** Get/put the first (or last) object from a collection. Generall y only useful if the collection
only ever has a single object -- which is a "singleton collecti on". only ever has a single object -- which is a "singleton collecti on".
You do not need to set the database (Context) before calling. You do not need to set the database (Context) before calling.
@return true if object exists. @return true if object exists.
*/ */
static bool getSingleton(const char *ns, BSONObj& result); static bool getSingleton(const char *ns, BSONObj& result);
 End of changes. 2 change blocks. 
0 lines changed or deleted 5 lines changed or added


 goodies.h   goodies.h 
skipping to change at line 620 skipping to change at line 620
bool operator==( const char * str ) const { bool operator==( const char * str ) const {
return strcmp( _buf , str ) == 0; return strcmp( _buf , str ) == 0;
} }
bool operator!=( const char * str ) const { bool operator!=( const char * str ) const {
return strcmp( _buf , str ) != 0; return strcmp( _buf , str ) != 0;
} }
bool empty() const { bool empty() const {
return _buf[0] == 0; return _buf == 0 || _buf[0] == 0;
} }
private: private:
size_t _size; size_t _size;
char * _buf; char * _buf;
}; };
ostream& operator<<( ostream &s, const ThreadSafeString &o ); ostream& operator<<( ostream &s, const ThreadSafeString &o );
inline bool isNumber( char c ) { inline bool isNumber( char c ) {
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 hostandport.h   hostandport.h 
skipping to change at line 77 skipping to change at line 77
bool isLocalHost() const; bool isLocalHost() const;
// @returns host:port // @returns host:port
string toString() const; string toString() const;
operator string() const { return toString(); } operator string() const { return toString(); }
string host() const { return _host; } string host() const { return _host; }
int port() const { return _port >= 0 ? _port : CmdLine::DefaultDBPo rt; } int port() const { return _port >= 0 ? _port : CmdLine::DefaultDBPo rt; }
bool hasPort() const { return _port >= 0; }
void setPort( int port ) { _port = port; } void setPort( int port ) { _port = port; }
private: private:
// invariant (except full obj assignment): // invariant (except full obj assignment):
string _host; string _host;
int _port; // -1 indicates unspecified int _port; // -1 indicates unspecified
}; };
/** returns true if strings seem to be the same hostname. /** returns true if strings seem to be the same hostname.
"nyc1" and "nyc1.acme.com" are treated as the same. "nyc1" and "nyc1.acme.com" are treated as the same.
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 msg.h   msg.h 
skipping to change at line 30 skipping to change at line 30
#include <deque> #include <deque>
#include "task.h" #include "task.h"
namespace mongo { namespace mongo {
namespace task { namespace task {
typedef boost::function<void()> lam; typedef boost::function<void()> lam;
/** typical usage is: task::fork( serverPtr ); */ /** typical usage is: task::fork( new Server("threadname") ); */
class Server : public Task { class Server : public Task {
public: public:
/** send a message to the port */ /** send a message to the port */
void send(lam); void send(lam);
Server(string name) : _name(name) { } Server(string name) : _name(name), rq(false) { }
virtual ~Server() { } virtual ~Server() { }
/** send message but block until function completes */ /** send message but block until function completes */
void call(const lam&); void call(const lam&);
void requeue() { rq = true; } void requeue() { rq = true; }
protected: protected:
/* this needn't be abstract; i left it that way for now so i re /* REMINDER : for use in mongod, you will want to have this cal
member l Client::initThread(). */
to call Client::initThread() when using in mongo... */ virtual void starting() { }
virtual void starting() = 0;
private: private:
virtual bool initClient() { return true; } virtual bool initClient() { return true; }
virtual string name() { return _name; } virtual string name() { return _name; }
void doWork(); void doWork();
deque<lam> d; deque<lam> d;
boost::mutex m; boost::mutex m;
boost::condition c; boost::condition c;
string _name; string _name;
bool rq; bool rq;
 End of changes. 3 change blocks. 
6 lines changed or deleted 5 lines changed or added


 rs.h   rs.h 
skipping to change at line 308 skipping to change at line 308
Member *_self; Member *_self;
private: private:
List1<Member> _members; /* all members of the set EXCEPT self. */ List1<Member> _members; /* all members of the set EXCEPT self. */
public: public:
unsigned selfId() const { return _self->id(); } unsigned selfId() const { return _self->id(); }
Manager *mgr; Manager *mgr;
private: private:
Member* head() const { return _members.head(); } Member* head() const { return _members.head(); }
Member* findById(unsigned id) const; public:
const Member* findById(unsigned id) const;
private:
void _getTargets(list<Target>&, int &configVersion); void _getTargets(list<Target>&, int &configVersion);
void getTargets(list<Target>&, int &configVersion); void getTargets(list<Target>&, int &configVersion);
void startThreads(); void startThreads();
friend class FeedbackThread; friend class FeedbackThread;
friend class CmdReplSetElect; friend class CmdReplSetElect;
friend class Member; friend class Member;
friend class Manager; friend class Manager;
friend class Consensus; friend class Consensus;
private: private:
 End of changes. 1 change blocks. 
1 lines changed or deleted 3 lines changed or added


 shard.h   shard.h 
skipping to change at line 57 skipping to change at line 57
Shard( const Shard* other ) Shard( const Shard* other )
: _name( other->_name ) , _addr( other->_addr ), _maxSize( othe r->_maxSize ) , _isDraining( other->_isDraining ){ : _name( other->_name ) , _addr( other->_addr ), _maxSize( othe r->_maxSize ) , _isDraining( other->_isDraining ){
} }
static Shard make( const string& ident ){ static Shard make( const string& ident ){
Shard s; Shard s;
s.reset( ident ); s.reset( ident );
return s; return s;
} }
static bool isAShard( const string& ident );
/** /**
* @param ident either name or address * @param ident either name or address
*/ */
void reset( const string& ident ); void reset( const string& ident );
void setAddress( const string& addr , bool authoritative = false ); void setAddress( const string& addr , bool authoritative = false );
string getName() const { string getName() const {
assert( _name.size() ); assert( _name.size() );
return _name; return _name;
skipping to change at line 128 skipping to change at line 130
} }
BSONObj runCommand( const string& db , const string& simple ) const { BSONObj runCommand( const string& db , const string& simple ) const {
return runCommand( db , BSON( simple << 1 ) ); return runCommand( db , BSON( simple << 1 ) );
} }
BSONObj runCommand( const string& db , const BSONObj& cmd ) const ; BSONObj runCommand( const string& db , const BSONObj& cmd ) const ;
ShardStatus getStatus() const ; ShardStatus getStatus() const ;
static void getAllShards( vector<Shard>& all ); static void getAllShards( vector<Shard>& all );
static void printShardInfo( ostream& out );
/** /**
* picks a Shard for more load * picks a Shard for more load
*/ */
static Shard pick(); static Shard pick();
static void reloadShardInfo(); static void reloadShardInfo();
static void removeShard( const string& name ); static void removeShard( const string& name );
skipping to change at line 183 skipping to change at line 186
long long mapped() const { long long mapped() const {
return _mapped; return _mapped;
} }
private: private:
Shard _shard; Shard _shard;
long long _mapped; long long _mapped;
double _writeLock; double _writeLock;
}; };
class ShardConnection : boost::noncopyable{ class ShardConnection : public AScopedConnection {
public: public:
ShardConnection( const Shard * s , const string& ns ); ShardConnection( const Shard * s , const string& ns );
ShardConnection( const Shard& s , const string& ns ); ShardConnection( const Shard& s , const string& ns );
ShardConnection( const string& addr , const string& ns ); ShardConnection( const string& addr , const string& ns );
~ShardConnection(); ~ShardConnection();
void done(); void done();
void kill(); void kill();
skipping to change at line 234 skipping to change at line 237
_setVersion = false; _setVersion = false;
_finishedInit = true; _finishedInit = true;
} }
/** /**
this just passes through excpet it checks for stale configs this just passes through excpet it checks for stale configs
*/ */
bool runCommand( const string& db , const BSONObj& cmd , BSONObj& r es ); bool runCommand( const string& db , const BSONObj& cmd , BSONObj& r es );
/** checks all of my thread local connections for the version of th is ns */ /** checks all of my thread local connections for the version of th is ns */
static void checkMyConnectionVersions( const string & ns ); static void checkMyConnectionVersions( const string & ns );
private: private:
void _init(); void _init();
void _finishInit(); void _finishInit();
bool _finishedInit; bool _finishedInit;
string _addr; string _addr;
string _ns; string _ns;
DBClientBase* _conn; DBClientBase* _conn;
 End of changes. 4 change blocks. 
2 lines changed or deleted 5 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/