diff options
author | Benety Goh <benety@mongodb.com> | 2015-09-23 20:20:33 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2015-09-24 22:20:28 -0400 |
commit | db6396298c7747060c822f6b22e35a08fc847a01 (patch) | |
tree | 978a4c6306918610a80d725f5b97808593e5c363 /src/mongo/db/dbhelpers.h | |
parent | a2e4770b90d0cc29375e3a2975010fc98e95a167 (diff) | |
download | mongo-db6396298c7747060c822f6b22e35a08fc847a01.tar.gz |
SERVER-15929 RemoveSaver::goingToDelete() returns error status if it fails to open file or write document to file
Diffstat (limited to 'src/mongo/db/dbhelpers.h')
-rw-r--r-- | src/mongo/db/dbhelpers.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mongo/db/dbhelpers.h b/src/mongo/db/dbhelpers.h index a3e5f735afa..2c0d448cf01 100644 --- a/src/mongo/db/dbhelpers.h +++ b/src/mongo/db/dbhelpers.h @@ -28,6 +28,8 @@ #pragma once +#include <iosfwd> +#include <memory> #include <boost/filesystem/path.hpp> #include "mongo/db/db.h" @@ -216,14 +218,18 @@ struct Helpers { public: RemoveSaver(const std::string& type, const std::string& ns, const std::string& why); - ~RemoveSaver(); - void goingToDelete(const BSONObj& o); + /** + * Writes document to file. File is created lazily before writing the first document. + * Returns error status if the file could not be created or if there were errors writing + * to the file. + */ + Status goingToDelete(const BSONObj& o); private: boost::filesystem::path _root; boost::filesystem::path _file; - std::ofstream* _out; + std::unique_ptr<std::ostream> _out; }; }; |