Merge branch 'master' of git@github.com:mongodb/mongo

Conflicts:

	SConstruct
	db/dbinfo.h
This commit is contained in:
dwight
2009-12-29 13:45:46 -05:00
105 changed files with 872 additions and 590 deletions

View File

@@ -77,14 +77,14 @@ namespace mongo {
stringstream temp;
temp << "can't append type from:";
temp << t;
uassert( temp.str() , 0 );
uassert( 10206 , temp.str() , 0 );
}
}
int Scope::invoke( const char* code , const BSONObj& args, int timeoutMs ){
ScriptingFunction func = createFunction( code );
uassert( "compile failed" , func );
uassert( 10207 , "compile failed" , func );
return invoke( func , args, timeoutMs );
}
@@ -99,11 +99,27 @@ namespace mongo {
return false;
}
// iterate directories and recurse using all *.js files in the directory
if ( is_directory( p ) ){
cout << "can't read directory [" << filename << "]" << endl;
if ( assertOnError )
assert( 0 );
return false;
directory_iterator end;
bool empty = true;
for (directory_iterator it (p); it != end; it++){
empty = false;
path sub (*it);
if (!endsWith(sub.string().c_str(), ".js"))
continue;
if (!execFile(sub.string().c_str(), printResult, reportError, assertOnError, timeoutMs))
return false;
}
if (empty){
cout << "directory [" << filename << "] doesn't have any *.js files" << endl;
if ( assertOnError )
assert( 0 );
return false;
}
return true;
}
File f;
@@ -123,7 +139,7 @@ namespace mongo {
}
void Scope::validateObjectIdString( const string &str ) {
massert ( "invalid object id: length", str.size() == 24 );
massert( 10448 , "invalid object id: length", str.size() == 24 );
for ( string::size_type i=0; i<str.size(); i++ ){
char c = str[i];
@@ -132,7 +148,7 @@ namespace mongo {
( c >= 'A' && c <= 'F' ) ){
continue;
}
massert( "invalid object id: not hex", false );
massert( 10430 , "invalid object id: not hex", false );
}
}
@@ -140,7 +156,7 @@ namespace mongo {
if ( _localDBName.size() == 0 ){
if ( ignoreNotConnected )
return;
uassert( "need to have locallyConnected already" , _localDBName.size() );
uassert( 10208 , "need to have locallyConnected already" , _localDBName.size() );
}
if ( _loadedVersion == _lastVersion )
return;
@@ -157,8 +173,8 @@ namespace mongo {
BSONElement n = o["_id"];
BSONElement v = o["value"];
uassert( "name has to be a string" , n.type() == String );
uassert( "value has to be set" , v.type() != EOO );
uassert( 10209 , "name has to be a string" , n.type() == String );
uassert( 10210 , "value has to be set" , v.type() != EOO );
setElement( n.valuestr() , v );
}