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) => {
|
MergedChunkInfo::Known(chunk_list) => {
|
||||||
let mut digest_list = vec![];
|
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());
|
//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());
|
println!("append existing chunks ({})", digest_list.len());
|
||||||
let param = json!({ "wid": wid, "digest-list": digest_list });
|
let param = json!({ "wid": wid, "digest-list": digest_list });
|
||||||
|
@ -10,7 +10,7 @@ pub struct ChunkInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub enum MergedChunkInfo {
|
pub enum MergedChunkInfo {
|
||||||
Known(Vec<ChunkInfo>),
|
Known(Vec<(u64,[u8;32])>),
|
||||||
New(ChunkInfo),
|
New(ChunkInfo),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,11 +65,11 @@ impl <S> Stream for MergeKnownChunksQueue<S>
|
|||||||
|
|
||||||
match last {
|
match last {
|
||||||
None => {
|
None => {
|
||||||
self.buffer = Some(MergedChunkInfo::Known(vec![chunk_info]));
|
self.buffer = Some(MergedChunkInfo::Known(vec![(chunk_info.offset, chunk_info.digest)]));
|
||||||
// continue
|
// continue
|
||||||
}
|
}
|
||||||
Some(MergedChunkInfo::Known(mut list)) => {
|
Some(MergedChunkInfo::Known(mut list)) => {
|
||||||
list.push(chunk_info);
|
list.push((chunk_info.offset, chunk_info.digest));
|
||||||
let len = list.len();
|
let len = list.len();
|
||||||
self.buffer = Some(MergedChunkInfo::Known(list));
|
self.buffer = Some(MergedChunkInfo::Known(list));
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ impl <S> Stream for MergeKnownChunksQueue<S>
|
|||||||
|
|
||||||
}
|
}
|
||||||
Some(MergedChunkInfo::New(_)) => {
|
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));
|
return Ok(Async::Ready(last));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user