Use dmlc stream when URI protocol is not local file. (#5857)

This commit is contained in:
Jiaming Yuan
2020-07-07 03:07:12 +08:00
committed by GitHub
parent 0f17e35bce
commit 4b0852ee41
3 changed files with 96 additions and 27 deletions

View File

@@ -75,7 +75,16 @@ class FixedSizeStream : public PeekableInStream {
std::string buffer_;
};
std::string LoadSequentialFile(std::string fname);
/*!
* \brief Helper function for loading consecutive file to avoid dmlc Stream when possible.
*
* \param uri URI or file name to file.
* \param stream Use dmlc Stream unconditionally if set to true. Used for running test
* without remote filesystem.
*
* \return File content.
*/
std::string LoadSequentialFile(std::string uri, bool stream = false);
inline std::string FileExtension(std::string const& fname) {
auto splited = Split(fname, '.');