diff options
author | Shaun Verch <shaun.verch@10gen.com> | 2013-09-03 14:53:58 -0400 |
---|---|---|
committer | Shaun Verch <shaun.verch@10gen.com> | 2013-09-04 16:25:48 -0400 |
commit | d564102905bf073b8370f872d1a2cac664084006 (patch) | |
tree | 324d3ea45b20b6da31476a4f4a06ca4734055bd2 | |
parent | 5f40281d1463a4925086b29567499924dec04889 (diff) | |
download | mongo-d564102905bf073b8370f872d1a2cac664084006.tar.gz |
Removed old unused Model class
-rw-r--r-- | docs/errors.md | 8 | ||||
-rw-r--r-- | src/SConscript.client | 1 | ||||
-rw-r--r-- | src/mongo/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/client/dbclient.h | 1 | ||||
-rw-r--r-- | src/mongo/client/model.cpp | 140 | ||||
-rw-r--r-- | src/mongo/client/model.h | 61 | ||||
-rw-r--r-- | src/mongo/db/mongod.vcxproj | 2 | ||||
-rw-r--r-- | src/mongo/db/mongod.vcxproj.filters | 6 | ||||
-rw-r--r-- | src/mongo/dbtests/test.vcxproj | 2 | ||||
-rwxr-xr-x | src/mongo/dbtests/test.vcxproj.filters | 6 | ||||
-rw-r--r-- | src/mongo/s/config.cpp | 1 | ||||
-rw-r--r-- | src/mongo/s/mongos.vcxproj | 2 | ||||
-rwxr-xr-x | src/mongo/s/mongos.vcxproj.filters | 6 |
13 files changed, 0 insertions, 237 deletions
diff --git a/docs/errors.md b/docs/errors.md index 9b73d27be91..3f107a218f2 100644 --- a/docs/errors.md +++ b/docs/errors.md @@ -151,14 +151,6 @@ src/mongo/client/gridfs.cpp * 9008 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/client/gridfs.cpp#L141) filemd5 failed -src/mongo/client/model.cpp ----- -* 10016 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/client/model.cpp#L39) _id isn't set - needed for remove()" , _id["_id -* 13121 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/client/model.cpp#L81) -* 9002 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/client/model.cpp#L51) error on Model::remove: -* 9003 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/client/model.cpp#L123) error on Model::save: - - src/mongo/client/parallel.cpp ---- * 10017 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/client/parallel.cpp#L101) cursor already done diff --git a/src/SConscript.client b/src/SConscript.client index e8952c22a17..0e62e589144 100644 --- a/src/SConscript.client +++ b/src/SConscript.client @@ -45,7 +45,6 @@ clientSourceBasic = [ 'mongo/client/dbclient_rs.cpp', 'mongo/client/dbclientcursor.cpp', 'mongo/client/gridfs.cpp', - 'mongo/client/model.cpp', 'mongo/client/sasl_client_authenticate.cpp', 'mongo/client/syncclusterconnection.cpp', 'mongo/db/jsobj.cpp', diff --git a/src/mongo/SConscript b/src/mongo/SConscript index ba3ee98d890..0825cffc176 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -230,7 +230,6 @@ commonFiles = [ "pch.cpp", "client/dbclient.cpp", "client/dbclient_rs.cpp", "client/dbclientcursor.cpp", - "client/model.cpp", 'client/sasl_client_authenticate.cpp', "client/syncclusterconnection.cpp", "db/dbmessage.cpp" diff --git a/src/mongo/client/dbclient.h b/src/mongo/client/dbclient.h index fec62d1614a..b2f4e1382fc 100644 --- a/src/mongo/client/dbclient.h +++ b/src/mongo/client/dbclient.h @@ -34,7 +34,6 @@ #include "mongo/client/dbclientcursor.h" #include "mongo/client/dbclientinterface.h" #include "mongo/client/gridfs.h" -#include "mongo/client/model.h" #include "mongo/client/sasl_client_authenticate.h" #include "mongo/client/syncclusterconnection.h" diff --git a/src/mongo/client/model.cpp b/src/mongo/client/model.cpp deleted file mode 100644 index deb3243b4dd..00000000000 --- a/src/mongo/client/model.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// model.cpp - -/* Copyright 2009 10gen - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mongo/pch.h" - -#include "mongo/client/model.h" - -#include "mongo/client/connpool.h" - -namespace mongo { - - bool Model::load(BSONObj& query) { - ScopedDbConnection conn(modelServer()); - - BSONObj b = conn->findOne(getNS(), query); - conn.done(); - - if ( b.isEmpty() ) - return false; - - unserialize(b); - _id = b["_id"].wrap().getOwned(); - return true; - } - - void Model::remove( bool safe ) { - uassert( 10016 , "_id isn't set - needed for remove()" , _id["_id"].type() ); - - ScopedDbConnection conn(modelServer()); - conn->remove( getNS() , _id ); - - string errmsg = ""; - if ( safe ) - errmsg = conn->getLastError(); - - conn.done(); - - if ( safe && errmsg.size() ) - throw UserException( 9002 , (string)"error on Model::remove: " + errmsg ); - } - - void Model::save( bool safe ) { - ScopedDbConnection conn(modelServer()); - - BSONObjBuilder b; - serialize( b ); - - BSONElement myId; - { - BSONObjIterator i = b.iterator(); - while ( i.more() ) { - BSONElement e = i.next(); - if ( strcmp( e.fieldName() , "_id" ) == 0 ) { - myId = e; - break; - } - } - } - - if ( myId.type() ) { - if ( _id.isEmpty() ) { - _id = myId.wrap(); - } - else if ( myId.woCompare( _id.firstElement() ) ) { - stringstream ss; - ss << "_id from serialize and stored differ: "; - ss << '[' << myId << "] != "; - ss << '[' << _id.firstElement() << ']'; - throw UserException( 13121 , ss.str() ); - } - } - - if ( _id.isEmpty() ) { - OID oid; - oid.init(); - b.appendOID( "_id" , &oid ); - - BSONObj o = b.obj(); - conn->insert( getNS() , o ); - _id = o["_id"].wrap().getOwned(); - - LOG(4) << "inserted new model " << getNS() << " " << o << endl; - } - else { - if ( myId.eoo() ) { - myId = _id["_id"]; - b.append( myId ); - } - - verify( ! myId.eoo() ); - - BSONObjBuilder qb; - qb.append( myId ); - - BSONObj q = qb.obj(); - BSONObj o = b.obj(); - - LOG(4) << "updated model" << getNS() << " " << q << " " << o << endl; - - conn->update( getNS() , q , o , true ); - - } - - string errmsg = ""; - if ( safe ) - errmsg = conn->getLastError(); - - conn.done(); - - if ( safe && errmsg.size() ) - throw UserException( 9003 , (string)"error on Model::save: " + errmsg ); - } - - BSONObj Model::toObject() { - BSONObjBuilder b; - serialize( b ); - return b.obj(); - } - - void Model::append( const char * name , BSONObjBuilder& b ) { - BSONObjBuilder bb( b.subobjStart( name ) ); - serialize( bb ); - bb.done(); - } - -} // namespace mongo diff --git a/src/mongo/client/model.h b/src/mongo/client/model.h deleted file mode 100644 index 249a78c3640..00000000000 --- a/src/mongo/client/model.h +++ /dev/null @@ -1,61 +0,0 @@ -/** @file model.h */ - -/* Copyright 2009 10gen - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "mongo/bson/bsonelement.h" -#include "mongo/bson/bsonobj.h" - -namespace mongo { - - /** Model is a base class for defining objects which are serializable to the Mongo - database via the database driver. - - Definition - Your serializable class should inherit from Model and implement the abstract methods - below. - - Loading - To load, first construct an (empty) object. Then call load(). Do not load an object - more than once. - */ - class Model { - public: - Model() { } - virtual ~Model() { } - - virtual const char * getNS() = 0; - virtual void serialize(BSONObjBuilder& to) = 0; - virtual void unserialize(const BSONObj& from) = 0; - virtual BSONObj toObject(); - virtual void append( const char * name , BSONObjBuilder& b ); - - virtual string modelServer() = 0; - - /** Load a single object. - @return true if successful. - */ - virtual bool load(BSONObj& query); - virtual void save( bool safe=false ); - virtual void remove( bool safe=false ); - - protected: - BSONObj _id; - }; - -} // namespace mongo - diff --git a/src/mongo/db/mongod.vcxproj b/src/mongo/db/mongod.vcxproj index 7ca39da6050..96b238f39dd 100644 --- a/src/mongo/db/mongod.vcxproj +++ b/src/mongo/db/mongod.vcxproj @@ -2090,7 +2090,6 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj <ClCompile Include="..\client\dbclient_rs.cpp" />
<ClCompile Include="..\client\distlock.cpp" />
<ClCompile Include="..\client\distlock_test.cpp" />
- <ClCompile Include="..\client\model.cpp" />
<ClCompile Include="..\client\sasl_client_authenticate.cpp" />
<ClCompile Include="..\logger\console.cpp" />
<ClCompile Include="..\logger\logger.cpp" />
@@ -4872,7 +4871,6 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj <ClInclude Include="stats\top.h" />
<ClInclude Include="..\client\connpool.h" />
<ClInclude Include="..\client\dbclient.h" />
- <ClInclude Include="..\client\model.h" />
<ClInclude Include="..\client\redef_macros.h" />
<ClInclude Include="..\client\syncclusterconnection.h" />
<ClInclude Include="..\client\undef_macros.h" />
diff --git a/src/mongo/db/mongod.vcxproj.filters b/src/mongo/db/mongod.vcxproj.filters index ec37431f29d..82a556eaefa 100644 --- a/src/mongo/db/mongod.vcxproj.filters +++ b/src/mongo/db/mongod.vcxproj.filters @@ -404,9 +404,6 @@ <ClCompile Include="..\client\distlock.cpp">
<Filter>client\Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\client\model.cpp">
- <Filter>client\Source Files</Filter>
- </ClCompile>
<ClCompile Include="repl\rs.cpp">
<Filter>db\repl</Filter>
</ClCompile>
@@ -2726,9 +2723,6 @@ <ClInclude Include="..\client\gridfs.h">
<Filter>client\Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\client\model.h">
- <Filter>client\Header Files</Filter>
- </ClInclude>
<ClInclude Include="..\client\parallel.h">
<Filter>client\Header Files</Filter>
</ClInclude>
diff --git a/src/mongo/dbtests/test.vcxproj b/src/mongo/dbtests/test.vcxproj index 1e668d97bbf..afedffb49cd 100644 --- a/src/mongo/dbtests/test.vcxproj +++ b/src/mongo/dbtests/test.vcxproj @@ -988,7 +988,6 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj <ClInclude Include="..\..\third_party\pcre-8.30\pcre.h" />
<ClInclude Include="..\client\connpool.h" />
<ClInclude Include="..\client\dbclient.h" />
- <ClInclude Include="..\client\model.h" />
<ClInclude Include="..\db\btree.h" />
<ClInclude Include="..\db\clientcursor.h" />
<ClInclude Include="..\db\cmdline.h" />
@@ -2386,7 +2385,6 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj <ClCompile Include="..\client\dbclient_rs.cpp" />
<ClCompile Include="..\client\distlock.cpp" />
<ClCompile Include="..\client\gridfs.cpp" />
- <ClCompile Include="..\client\model.cpp" />
<ClCompile Include="..\client\parallel.cpp" />
<ClCompile Include="..\client\sasl_client_authenticate.cpp" />
<ClCompile Include="..\db\audit.cpp" />
diff --git a/src/mongo/dbtests/test.vcxproj.filters b/src/mongo/dbtests/test.vcxproj.filters index 545dffb383b..71352617da5 100755 --- a/src/mongo/dbtests/test.vcxproj.filters +++ b/src/mongo/dbtests/test.vcxproj.filters @@ -286,9 +286,6 @@ <ClInclude Include="..\client\dbclient.h">
<Filter>client</Filter>
</ClInclude>
- <ClInclude Include="..\client\model.h">
- <Filter>client</Filter>
- </ClInclude>
<ClInclude Include="..\util\concurrency\list.h">
<Filter>util\concurrency</Filter>
</ClInclude>
@@ -3399,9 +3396,6 @@ <ClCompile Include="..\db\repl\manager.cpp">
<Filter>db\repl</Filter>
</ClCompile>
- <ClCompile Include="..\client\model.cpp">
- <Filter>client</Filter>
- </ClCompile>
<ClCompile Include="..\util\net\listen.cpp">
<Filter>util\net</Filter>
</ClCompile>
diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp index acc68fe7f1c..d2c1f8e616f 100644 --- a/src/mongo/s/config.cpp +++ b/src/mongo/s/config.cpp @@ -34,7 +34,6 @@ #include "mongo/client/connpool.h" #include "mongo/client/dbclientcursor.h" -#include "mongo/client/model.h" #include "mongo/db/cmdline.h" #include "mongo/db/pdfile.h" #include "mongo/s/chunk.h" diff --git a/src/mongo/s/mongos.vcxproj b/src/mongo/s/mongos.vcxproj index 805d216a63e..d299144a553 100644 --- a/src/mongo/s/mongos.vcxproj +++ b/src/mongo/s/mongos.vcxproj @@ -3264,7 +3264,6 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj <ClCompile Include="..\..\third_party\pcre-8.30\pcre_xclass.c" />
<ClCompile Include="..\..\third_party\pcre-8.30\pcreposix.c" />
<ClCompile Include="..\client\dbclient.cpp" />
- <ClCompile Include="..\client\model.cpp" />
<ClCompile Include="..\util\assert_util.cpp" />
<ClCompile Include="..\util\background.cpp" />
<ClCompile Include="..\util\base64.cpp" />
@@ -4068,7 +4067,6 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj <ClInclude Include="..\..\third_party\pcre-8.30\pcre.h" />
<ClInclude Include="..\client\connpool.h" />
<ClInclude Include="..\client\dbclient.h" />
- <ClInclude Include="..\client\model.h" />
<ClInclude Include="type_changelog.h" />
<ClInclude Include="type_chunk.h" />
<ClInclude Include="type_collection.h" />
diff --git a/src/mongo/s/mongos.vcxproj.filters b/src/mongo/s/mongos.vcxproj.filters index f17707dce41..1c0d865382b 100755 --- a/src/mongo/s/mongos.vcxproj.filters +++ b/src/mongo/s/mongos.vcxproj.filters @@ -266,9 +266,6 @@ <ClCompile Include="..\client\dbclientcursor.cpp">
<Filter>client</Filter>
</ClCompile>
- <ClCompile Include="..\client\model.cpp">
- <Filter>client</Filter>
- </ClCompile>
<ClCompile Include="shardconnection.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -299,9 +296,6 @@ <ClInclude Include="..\client\dbclient.h">
<Filter>client</Filter>
</ClInclude>
- <ClInclude Include="..\client\model.h">
- <Filter>client</Filter>
- </ClInclude>
<ClCompile Include="interrupt_status_mongos.cpp">
<Filter>Source Files</Filter>
</ClCompile>
|