Send the number of the next chunk to be uploaded.
This commit is contained in:
parent
60b9d9fa01
commit
854f383172
@ -20,9 +20,9 @@ class FileStorage::Errors
|
|||||||
property mid : String
|
property mid : String
|
||||||
property reason = "Chunk already present"
|
property reason = "Chunk already present"
|
||||||
property filedigest : String
|
property filedigest : String
|
||||||
property chunk : Chunk
|
property next_chunk : Int32
|
||||||
|
|
||||||
def initialize(@mid, @filedigest, @chunk)
|
def initialize(@mid, @filedigest, @next_chunk)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
FileStorage.errors << ChunkAlreadyUploaded
|
FileStorage.errors << ChunkAlreadyUploaded
|
||||||
|
@ -105,8 +105,9 @@ class FileStorage::Storage
|
|||||||
if transfer_info.chunks.select do |v| v == chunk_number end.size == 1
|
if transfer_info.chunks.select do |v| v == chunk_number end.size == 1
|
||||||
write_a_chunk file_digest, chunk_size, chunk_number, data
|
write_a_chunk file_digest, chunk_size, chunk_number, data
|
||||||
else
|
else
|
||||||
# TODO: send the remaining chunks to upload.
|
# Send the next remaining chunk to upload.
|
||||||
raise "non existent chunk or already uploaded"
|
next_chunk = transfer_info.chunks.sort.first
|
||||||
|
return FileStorage::Errors::ChunkAlreadyUploaded.new mid, file_digest, next_chunk
|
||||||
end
|
end
|
||||||
|
|
||||||
remove_chunk_from_db transfer_info, chunk_number
|
remove_chunk_from_db transfer_info, chunk_number
|
||||||
|
Loading…
Reference in New Issue
Block a user