diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-04-09 11:27:14 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-04-16 09:04:28 +0300 |
commit | d9b72ffa5485f3c253da22f09ff0a7090de7aa37 (patch) | |
tree | ffcfc0d0b2377c95072b609095589fbf83424382 /src/chunk.rs | |
parent | 9f6ff22ff9a1b0a5a28d037846b1cecee4f2945c (diff) | |
download | obnam2-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/chunk.rs')
-rw-r--r-- | src/chunk.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/chunk.rs b/src/chunk.rs index df16a98..4f604b9 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -1,8 +1,8 @@ //! Chunks of data. -use crate::checksummer::Checksum; use crate::chunkid::ChunkId; use crate::chunkmeta::ChunkMeta; +use crate::label::Label; use serde::{Deserialize, Serialize}; use std::default::Default; @@ -97,7 +97,7 @@ impl GenerationChunk { let json: String = serde_json::to_string(self).map_err(GenerationChunkError::JsonGenerate)?; let bytes = json.as_bytes().to_vec(); - let checksum = Checksum::sha256(&bytes); + let checksum = Label::sha256(&bytes); let meta = ChunkMeta::new(&checksum); Ok(DataChunk::new(bytes, meta)) } @@ -185,7 +185,7 @@ impl ClientTrust { pub fn to_data_chunk(&self) -> Result<DataChunk, ClientTrustError> { let json: String = serde_json::to_string(self).map_err(ClientTrustError::JsonGenerate)?; let bytes = json.as_bytes().to_vec(); - let checksum = Checksum::literal("client-trust"); + let checksum = Label::literal("client-trust"); let meta = ChunkMeta::new(&checksum); Ok(DataChunk::new(bytes, meta)) } |