aboutsummaryrefslogtreecommitdiff
path: root/src/block/block.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-02-23 12:22:29 +0100
committerAlex Auvolat <alex@adnab.me>2024-02-23 12:22:29 +0100
commite9c42bca347e3a67f8d6bae953bdf0b53ce37d00 (patch)
treee553ba7d962767b9797aca1ad973de8e533f782a /src/block/block.rs
parentcd1069c1d4219deb7d48758fb9d0a45cc4c1eddb (diff)
downloadgarage-e9c42bca347e3a67f8d6bae953bdf0b53ce37d00.tar.gz
garage-e9c42bca347e3a67f8d6bae953bdf0b53ce37d00.zip
[refactor-block] add DataBlockStream type
Diffstat (limited to 'src/block/block.rs')
-rw-r--r--src/block/block.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/block/block.rs b/src/block/block.rs
index 0b14bad4..3f5c4f94 100644
--- a/src/block/block.rs
+++ b/src/block/block.rs
@@ -7,6 +7,8 @@ use zstd::stream::Encoder;
use garage_util::data::*;
use garage_util::error::*;
+use garage_net::stream::ByteStream;
+
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
pub enum DataBlockHeader {
Plain,
@@ -25,6 +27,9 @@ pub type DataBlock = DataBlockElem<Bytes>;
/// A path to a possibly compressed block of data
pub type DataBlockPath = DataBlockElem<PathBuf>;
+/// A stream of possibly compressed block data
+pub type DataBlockStream = DataBlockElem<ByteStream>;
+
impl DataBlockHeader {
pub fn is_compressed(&self) -> bool {
matches!(self, DataBlockHeader::Compressed)