You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/12/07 02:56:27 UTC

[GitHub] [incubator-doris] pengxiangyu commented on a change in pull request #7098: Support remote storage, step1: use a struct instead of string for parameter path, add basic remote method

pengxiangyu commented on a change in pull request #7098:
URL: https://github.com/apache/incubator-doris/pull/7098#discussion_r763590172



##########
File path: be/src/env/env_posix.cpp
##########
@@ -266,13 +277,38 @@ class PosixRandomAccessFile : public RandomAccessFile {
         }
     }
 
-    Status read_at(uint64_t offset, const Slice& result) const override {
-        return do_readv_at(_fd, _filename, offset, &result, 1);
+    Status read_at(uint64_t offset, const Slice* result) const override {
+        return readv_at(offset, result, 1);
+    }
+
+    Status readv_at(uint64_t offset, const Slice* result, size_t res_cnt) const override {
+        return do_readv_at(_fd, _filename, offset, result, res_cnt);
     }
 
-    Status readv_at(uint64_t offset, const Slice* res, size_t res_cnt) const override {
-        return do_readv_at(_fd, _filename, offset, res, res_cnt);
+    Status read_all(std::string* content) const override {
+        std::fstream fs(_filename.c_str(), std::fstream::in);
+        if (!fs.is_open()) {
+            RETURN_NOT_OK_STATUS_WITH_WARN(
+                    Status::IOError(
+                            strings::Substitute("failed to open cluster id file $0", _filename)),
+                    "open file failed");
+        }
+        std::string data;
+        fs >> data;
+        fs.close();
+        if ((fs.rdstate() & std::fstream::eofbit) != 0) {
+            *content = data;

Review comment:
       *content = data;  will take the string, these codes are not changed, they are only moved.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org