[refactor-block] add DataBlockStream type

This commit is contained in:
Alex Auvolat
2024-02-23 12:22:29 +01:00
parent cd1069c1d4
commit e9c42bca34
2 changed files with 18 additions and 14 deletions
+5
View File
@@ -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)