engine/snapshot/
compression.rs

1// Copyright 2020-2021 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4mod decoder;
5mod encoder;
6
7pub use decoder::{decompress, Lz4DecodeError};
8pub use encoder::compress;
9
10/// Block for the LZ4 compression algorithm.
11#[derive(Debug)]
12pub(crate) struct Block {
13    literal_length: usize,
14    duplicates: Option<Duplicate>,
15}
16
17/// Duplicate represented in the LZ4 algorithm.
18#[derive(Copy, Clone, Debug)]
19pub(crate) struct Duplicate {
20    offset: u16,
21    padding: usize,
22}