mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-05 05:22:07 +08:00
a031b938b0
* no-cache mode * fix test cases build error * space * don't create cache dir in no-cache mode * fix errors in test cases * no_local_cache_ * set the number of connections by chunk_size * use size_t instead of int64_t * add test case for no-cache mode * rename variables * fix SIGSEGV * cleanup * faster decompressBZ2 * always decompress bz2 * add test cases * prepare for python interface * fix test cases build error * continue * camera_replay: cache remote file * protected inheritance * single option name * TODO * test_case for LogReader&FrameReader * fix wrong require * test case for FileReader * cleanup test * test:fix wrong filename * check cached file's checksum * fix mkdir permissions err cleanup filereader * remove initialize libav network libraries. dd * abort all loading if one failed * cleanup tests * use threadpool to limit concurrent downloads * cache more segments * merge 3 segments for replay * one segment uses about 100M of memory * use segments_need_merge.size() * shutdown * fix stuck if exit replay before keyboard thread started * load one segment at a time * small cleanup * cleanup filereader * space * tiny cleanup * merge master * cleanup test cases * use util:create_directories * cleanup framereader old-commit-hash: 2b4a477fbc8fc02da5876aee4f955194916f19a3
21 lines
559 B
C++
21 lines
559 B
C++
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <string>
|
|
|
|
class FileReader {
|
|
public:
|
|
FileReader(bool cache_to_local, int chunk_size = -1, int max_retries = 3)
|
|
: cache_to_local_(cache_to_local), chunk_size_(chunk_size), max_retries_(max_retries) {}
|
|
virtual ~FileReader() {}
|
|
std::string read(const std::string &file, std::atomic<bool> *abort = nullptr);
|
|
|
|
private:
|
|
std::string download(const std::string &url, std::atomic<bool> *abort);
|
|
int chunk_size_;
|
|
int max_retries_;
|
|
bool cache_to_local_;
|
|
};
|
|
|
|
std::string cacheFilePath(const std::string &url);
|