src/client/merge_known_chunks.rs: reduce RAM usage
There is no need to store chunk data for known chunks.
This commit is contained in:
parent
ecb21b4794
commit
9bb675ec23
|
@ -582,9 +582,9 @@ impl BackupClient {
|
|||
}
|
||||
MergedChunkInfo::Known(chunk_list) => {
|
||||
let mut digest_list = vec![];
|
||||
for chunk_info in chunk_list {
|
||||
for (_offset, digest) in chunk_list {
|
||||
//println!("append existing chunk ({} bytes)", chunk_info.data.len());
|
||||
digest_list.push(tools::digest_to_hex(&chunk_info.digest));
|
||||
digest_list.push(tools::digest_to_hex(&digest));
|
||||
}
|
||||
println!("append existing chunks ({})", digest_list.len());
|
||||
let param = json!({ "wid": wid, "digest-list": digest_list });
|
||||
|
|
|
@ -10,7 +10,7 @@ pub struct ChunkInfo {
|
|||
}
|
||||
|
||||
pub enum MergedChunkInfo {
|
||||
Known(Vec<ChunkInfo>),
|
||||
Known(Vec<(u64,[u8;32])>),
|
||||
New(ChunkInfo),
|
||||
}
|
||||
|
||||
|
@ -65,11 +65,11 @@ impl <S> Stream for MergeKnownChunksQueue<S>
|
|||
|
||||
match last {
|
||||
None => {
|
||||
self.buffer = Some(MergedChunkInfo::Known(vec![chunk_info]));
|
||||
self.buffer = Some(MergedChunkInfo::Known(vec![(chunk_info.offset, chunk_info.digest)]));
|
||||
// continue
|
||||
}
|
||||
Some(MergedChunkInfo::Known(mut list)) => {
|
||||
list.push(chunk_info);
|
||||
list.push((chunk_info.offset, chunk_info.digest));
|
||||
let len = list.len();
|
||||
self.buffer = Some(MergedChunkInfo::Known(list));
|
||||
|
||||
|
@ -80,7 +80,7 @@ impl <S> Stream for MergeKnownChunksQueue<S>
|
|||
|
||||
}
|
||||
Some(MergedChunkInfo::New(_)) => {
|
||||
self.buffer = Some(MergedChunkInfo::Known(vec![chunk_info]));
|
||||
self.buffer = Some(MergedChunkInfo::Known(vec![(chunk_info.offset, chunk_info.digest)]));
|
||||
return Ok(Async::Ready(last));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue