summaryrefslogtreecommitdiff
path: root/src/chunker.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-04-09 11:27:14 +0300
committerLars Wirzenius <liw@liw.fi>2022-04-16 09:04:28 +0300
commitd9b72ffa5485f3c253da22f09ff0a7090de7aa37 (patch)
treeffcfc0d0b2377c95072b609095589fbf83424382 /src/chunker.rs
parent9f6ff22ff9a1b0a5a28d037846b1cecee4f2945c (diff)
downloadobnam2-d9b72ffa5485f3c253da22f09ff0a7090de7aa37.tar.gz
refactor: rename Checksum to Label
Label is a clearer and more accurate name for the type now that it is not just a checksum. Also, serialize a Label in tests, rather than using string literals. This is more correct, and we'll be changing serialization later. Sponsored-by: author
Diffstat (limited to 'src/chunker.rs')
-rw-r--r--src/chunker.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/chunker.rs b/src/chunker.rs
index 7954621..2394230 100644
--- a/src/chunker.rs
+++ b/src/chunker.rs
@@ -1,8 +1,8 @@
//! Split file data into chunks.
-use crate::checksummer::Checksum;
use crate::chunk::DataChunk;
use crate::chunkmeta::ChunkMeta;
+use crate::label::Label;
use std::io::prelude::*;
use std::path::{Path, PathBuf};
@@ -54,7 +54,7 @@ impl FileChunks {
}
let buffer = &self.buf.as_slice()[..used];
- let hash = Checksum::sha256(buffer);
+ let hash = Label::sha256(buffer);
let meta = ChunkMeta::new(&hash);
let chunk = DataChunk::new(buffer.to_vec(), meta);
Ok(Some(chunk))