Simplify FileLoadManager::get_content.

This commit is contained in:
levlam 2022-06-15 21:40:23 +03:00
parent 67605936ed
commit 62a97d8eb6
3 changed files with 4 additions and 5 deletions

View File

@ -132,9 +132,8 @@ void FileLoadManager::from_bytes(QueryId id, FileType type, BufferSlice bytes, s
CHECK(is_inserted);
}
void FileLoadManager::get_content(const FullLocalFileLocation &local_location, Promise<BufferSlice> promise) {
// TODO: send query to other thread
promise.set_result(read_file(local_location.path_));
void FileLoadManager::get_content(string file_path, Promise<BufferSlice> promise) {
promise.set_result(read_file(file_path));
}
// void upload_reload_parts(QueryId id, vector<int32> parts);

View File

@ -57,7 +57,7 @@ class FileLoadManager final : public Actor {
void update_local_file_location(QueryId id, const LocalFileLocation &local);
void update_downloaded_part(QueryId id, int64 offset, int64 limit);
void get_content(const FullLocalFileLocation &local_location, Promise<BufferSlice> promise);
void get_content(string file_path, Promise<BufferSlice> promise);
private:
struct Node {

View File

@ -2054,7 +2054,7 @@ void FileManager::get_content(FileId file_id, Promise<BufferSlice> promise) {
return promise.set_error(Status::Error("No local location"));
}
send_closure(file_load_manager_, &FileLoadManager::get_content, node->local_.full(), std::move(promise));
send_closure(file_load_manager_, &FileLoadManager::get_content, node->local_.full().path_, std::move(promise));
}
void FileManager::read_file_part(FileId file_id, int64 offset, int64 count, int left_tries,