value_log/compression.rs
1// Copyright (c) 2024-present, fjall-rs
2// This source code is licensed under both the Apache 2.0 and MIT License
3// (found in the LICENSE-* files in the repository)
4
5/// Generic compression trait
6pub trait Compressor {
7 /// Compresses a value
8 ///
9 /// # Errors
10 ///
11 /// Will return `Err` if an IO error occurs.
12 fn compress(&self, bytes: &[u8]) -> crate::Result<Vec<u8>>;
13
14 /// Decompresses a value
15 ///
16 /// # Errors
17 ///
18 /// Will return `Err` if an IO error occurs.
19 fn decompress(&self, bytes: &[u8]) -> crate::Result<Vec<u8>>;
20}