Simplify file_type_ update.
This commit is contained in:
parent
11ef2ec81a
commit
8755d39bc1
@ -110,34 +110,29 @@ Result<FileLoader::PrefixInfo> FileUploader::on_update_local_location(const Loca
|
|||||||
|
|
||||||
string path;
|
string path;
|
||||||
int64 local_size = -1;
|
int64 local_size = -1;
|
||||||
bool local_is_ready{false};
|
bool local_is_ready = false;
|
||||||
FileType file_type{FileType::Temp};
|
|
||||||
if (location.type() == LocalFileLocation::Type::Empty ||
|
if (location.type() == LocalFileLocation::Type::Empty ||
|
||||||
(location.type() == LocalFileLocation::Type::Partial && encryption_key_.is_secure())) {
|
(location.type() == LocalFileLocation::Type::Partial && encryption_key_.is_secure())) {
|
||||||
path = "";
|
path = "";
|
||||||
local_size = 0;
|
local_size = 0;
|
||||||
local_is_ready = false;
|
file_type_ = FileType::Temp;
|
||||||
file_type = FileType::Temp;
|
|
||||||
} else if (location.type() == LocalFileLocation::Type::Partial) {
|
} else if (location.type() == LocalFileLocation::Type::Partial) {
|
||||||
path = location.partial().path_;
|
path = location.partial().path_;
|
||||||
local_size = Bitmask(Bitmask::Decode{}, location.partial().ready_bitmask_)
|
local_size = Bitmask(Bitmask::Decode{}, location.partial().ready_bitmask_)
|
||||||
.get_ready_prefix_size(0, location.partial().part_size_, file_size);
|
.get_ready_prefix_size(0, location.partial().part_size_, file_size);
|
||||||
local_is_ready = false;
|
file_type_ = location.partial().file_type_;
|
||||||
file_type = location.partial().file_type_;
|
|
||||||
} else {
|
} else {
|
||||||
path = location.full().path_;
|
path = location.full().path_;
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
return Status::Error("FullLocalFileLocation with empty path");
|
return Status::Error("FullLocalFileLocation with empty path");
|
||||||
}
|
}
|
||||||
local_is_ready = true;
|
local_is_ready = true;
|
||||||
file_type = location.full().file_type_;
|
file_type_ = location.full().file_type_;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(INFO) << "In FileUploader::on_update_local_location with " << location << ". Have path = \"" << path
|
LOG(INFO) << "In FileUploader::on_update_local_location with " << location << ". Have path = \"" << path
|
||||||
<< "\", local_size = " << local_size << ", local_is_ready = " << local_is_ready
|
<< "\", local_size = " << local_size << ", local_is_ready = " << local_is_ready
|
||||||
<< " and file type = " << file_type;
|
<< " and file type = " << file_type_;
|
||||||
|
|
||||||
file_type_ = file_type;
|
|
||||||
|
|
||||||
bool is_temp = false;
|
bool is_temp = false;
|
||||||
if (encryption_key_.is_secure() && local_is_ready && remote_.type() == RemoteFileLocation::Type::Empty) {
|
if (encryption_key_.is_secure() && local_is_ready && remote_.type() == RemoteFileLocation::Type::Empty) {
|
||||||
|
Loading…
Reference in New Issue
Block a user