~aleteoryx/muditaos

6679e506709b886563e0446d3e0bc0698178a61c — Alek Rudnik 4 years ago fadb6b3
[EGD-7587] Change stream buffer size for fs endpoint

Increases stream buffer size, to make sure it is working faster
on ext4 partition.
M module-services/service-desktop/endpoints/filesystem/FileContext.cpp => module-services/service-desktop/endpoints/filesystem/FileContext.cpp +4 -1
@@ 13,11 13,14 @@ FileContext::FileContext(
    }

    file = std::fopen(path.c_str(), openMode.c_str());

    if (!file) {
        throw std::runtime_error("File open error");
    }

    constexpr size_t streamBufferSize = 16384;
    streamBuffer                      = std::make_unique<char[]>(streamBufferSize);
    setvbuf(file, streamBuffer.get(), _IOFBF, streamBufferSize);

    runningCrc32Digest.reset();
}


M module-services/service-desktop/endpoints/include/endpoints/filesystem/FileContext.hpp => module-services/service-desktop/endpoints/include/endpoints/filesystem/FileContext.hpp +1 -0
@@ 43,6 43,7 @@ class FileContext
    std::size_t offset{};
    std::size_t chunkSize{};
    CRC32 runningCrc32Digest;
    std::unique_ptr<char[]> streamBuffer;
};

class FileReadContext : public FileContext