Remove separate setFileDownloadOffset.
GitOrigin-RevId: b9588dbbc3929de9dba01c008bc18d1f36b24571
This commit is contained in:
parent
385e87d92c
commit
dd5b8a87c2
@ -2952,9 +2952,6 @@ setPinnedChats chat_ids:vector<int53> = Ok;
|
|||||||
//@offset File will be downloaded starting from that offset in bytes first. Supposed to be used for streaming
|
//@offset File will be downloaded starting from that offset in bytes first. Supposed to be used for streaming
|
||||||
downloadFile file_id:int32 priority:int32 offset:int32 = File;
|
downloadFile file_id:int32 priority:int32 offset:int32 = File;
|
||||||
|
|
||||||
//@description Sets offset for file downloading @file_id Identifier of the file to change download offset @offset New file download offset
|
|
||||||
setFileDownloadOffset file_id:int32 offset:int32 = File;
|
|
||||||
|
|
||||||
//@description Returns file downloaded prefix size from a given offset @file_id Identifier of the file @offset Offset from which downloaded prefix size should be calculated
|
//@description Returns file downloaded prefix size from a given offset @file_id Identifier of the file @offset Offset from which downloaded prefix size should be calculated
|
||||||
getFileDownloadedPrefixSize file_id:int32 offset:int32 = Count;
|
getFileDownloadedPrefixSize file_id:int32 offset:int32 = Count;
|
||||||
|
|
||||||
|
Binary file not shown.
@ -5693,19 +5693,6 @@ void Td::on_request(uint64 id, const td_api::downloadFile &request) {
|
|||||||
send_closure(actor_id(this), &Td::send_result, id, std::move(file));
|
send_closure(actor_id(this), &Td::send_result, id, std::move(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::setFileDownloadOffset &request) {
|
|
||||||
if (request.offset_ < 0) {
|
|
||||||
return send_error_raw(id, 5, "Download offset must be non-negative");
|
|
||||||
}
|
|
||||||
file_manager_->download_set_offset(FileId(request.file_id_, 0), request.offset_);
|
|
||||||
auto file = file_manager_->get_file_object(FileId(request.file_id_, 0), false);
|
|
||||||
if (file->id_ == 0) {
|
|
||||||
return send_error_raw(id, 400, "Invalid file id");
|
|
||||||
}
|
|
||||||
|
|
||||||
send_closure(actor_id(this), &Td::send_result, id, std::move(file));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::cancelDownloadFile &request) {
|
void Td::on_request(uint64 id, const td_api::cancelDownloadFile &request) {
|
||||||
file_manager_->download(FileId(request.file_id_, 0), nullptr, request.only_if_pending_ ? -1 : 0, -1);
|
file_manager_->download(FileId(request.file_id_, 0), nullptr, request.only_if_pending_ ? -1 : 0, -1);
|
||||||
|
|
||||||
|
@ -646,8 +646,6 @@ class Td final : public NetQueryCallback {
|
|||||||
|
|
||||||
void on_request(uint64 id, const td_api::downloadFile &request);
|
void on_request(uint64 id, const td_api::downloadFile &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::setFileDownloadOffset &request);
|
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::cancelDownloadFile &request);
|
void on_request(uint64 id, const td_api::cancelDownloadFile &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::uploadFile &request);
|
void on_request(uint64 id, td_api::uploadFile &request);
|
||||||
|
@ -2276,12 +2276,6 @@ class CliClient final : public Actor {
|
|||||||
send_request(make_tl_object<td_api::getMapThumbnailFile>(
|
send_request(make_tl_object<td_api::getMapThumbnailFile>(
|
||||||
as_location(latitude, longitude), to_integer<int32>(zoom), to_integer<int32>(width),
|
as_location(latitude, longitude), to_integer<int32>(zoom), to_integer<int32>(width),
|
||||||
to_integer<int32>(height), to_integer<int32>(scale), as_chat_id(chat_id)));
|
to_integer<int32>(height), to_integer<int32>(scale), as_chat_id(chat_id)));
|
||||||
} else if (op == "sfdo" || op == "SetDownloadFileOffset") {
|
|
||||||
string file_id;
|
|
||||||
string offset;
|
|
||||||
std::tie(file_id, offset) = split(args);
|
|
||||||
|
|
||||||
send_request(make_tl_object<td_api::setFileDownloadOffset>(as_file_id(file_id), to_integer<int32>(offset)));
|
|
||||||
} else if (op == "df" || op == "DownloadFile") {
|
} else if (op == "df" || op == "DownloadFile") {
|
||||||
string file_id;
|
string file_id;
|
||||||
string priority;
|
string priority;
|
||||||
|
@ -1619,18 +1619,6 @@ void FileManager::download(FileId file_id, std::shared_ptr<DownloadCallback> cal
|
|||||||
try_flush_node(node, "download");
|
try_flush_node(node, "download");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileManager::download_set_offset(FileId file_id, int64 offset) {
|
|
||||||
auto file_node = get_sync_file_node(file_id);
|
|
||||||
if (!file_node) {
|
|
||||||
LOG(INFO) << "File " << file_id << " not found";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
file_node->set_download_offset(offset);
|
|
||||||
run_generate(file_node);
|
|
||||||
run_download(file_node);
|
|
||||||
try_flush_node(file_node, "download_set_offset");
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileManager::run_download(FileNodePtr node) {
|
void FileManager::run_download(FileNodePtr node) {
|
||||||
if (node->need_load_from_pmc_) {
|
if (node->need_load_from_pmc_) {
|
||||||
return;
|
return;
|
||||||
|
@ -344,7 +344,6 @@ class FileManager : public FileLoadManager::Callback {
|
|||||||
bool set_content(FileId file_id, BufferSlice bytes);
|
bool set_content(FileId file_id, BufferSlice bytes);
|
||||||
|
|
||||||
void download(FileId file_id, std::shared_ptr<DownloadCallback> callback, int32 new_priority, int64 offset);
|
void download(FileId file_id, std::shared_ptr<DownloadCallback> callback, int32 new_priority, int64 offset);
|
||||||
void download_set_offset(FileId file_id, int64 offset);
|
|
||||||
void upload(FileId file_id, std::shared_ptr<UploadCallback> callback, int32 new_priority, uint64 upload_order);
|
void upload(FileId file_id, std::shared_ptr<UploadCallback> callback, int32 new_priority, uint64 upload_order);
|
||||||
void resume_upload(FileId file_id, std::vector<int> bad_parts, std::shared_ptr<UploadCallback> callback,
|
void resume_upload(FileId file_id, std::vector<int> bad_parts, std::shared_ptr<UploadCallback> callback,
|
||||||
int32 new_priority, uint64 upload_order);
|
int32 new_priority, uint64 upload_order);
|
||||||
|
Reference in New Issue
Block a user