summaryrefslogtreecommitdiff
path: root/src/store.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-10-14 09:00:22 +0300
committerLars Wirzenius <liw@liw.fi>2020-10-14 09:00:22 +0300
commit90fe57e7b5b383195d6155578c00d10549ead0d3 (patch)
treed003972953531c66cad4bc87bcd1f6a44644f979 /src/store.rs
parentb58261f996883a4f63487a50f48cbb20cf7d8fdb (diff)
downloadobnam2-90fe57e7b5b383195d6155578c00d10549ead0d3.tar.gz
refactor: rename Chunk to DataChunk
Diffstat (limited to 'src/store.rs')
-rw-r--r--src/store.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/store.rs b/src/store.rs
index bad52ce..8d50b2f 100644
--- a/src/store.rs
+++ b/src/store.rs
@@ -1,4 +1,4 @@
-use crate::chunk::Chunk;
+use crate::chunk::DataChunk;
use crate::chunkid::ChunkId;
use crate::chunkmeta::ChunkMeta;
use std::path::{Path, PathBuf};
@@ -26,7 +26,7 @@ impl Store {
}
/// Save a chunk into a store.
- pub fn save(&self, id: &ChunkId, meta: &ChunkMeta, chunk: &Chunk) -> anyhow::Result<()> {
+ pub fn save(&self, id: &ChunkId, meta: &ChunkMeta, chunk: &DataChunk) -> anyhow::Result<()> {
std::fs::write(&self.filename(id, "meta"), meta.to_json())?;
std::fs::write(&self.filename(id, "data"), chunk.data())?;
Ok(())
@@ -39,10 +39,10 @@ impl Store {
}
/// Load a chunk from a store.
- pub fn load(&self, id: &ChunkId) -> anyhow::Result<(ChunkMeta, Chunk)> {
+ pub fn load(&self, id: &ChunkId) -> anyhow::Result<(ChunkMeta, DataChunk)> {
let meta = self.load_meta(id)?;
let data = std::fs::read(&self.filename(id, "data"))?;
- Ok((meta, Chunk::new(data)))
+ Ok((meta, DataChunk::new(data)))
}
/// Delete a chunk from a store.