sstable compression (#1946)

* compress sstable with zstd

* add some details to sstable readme

* compress only block which benefit from it

* multiple changes to sstable

make compression optional
use OwnedBytes instead of impl Read in sstable, required for next point
use zstd bulk api, which is much faster on small records

* cleanup and use bulk api for compression

* use dedicated byte for compression

* switch block len and compression flag

* change default zstd level in sstable
This commit is contained in:
trinity-1686a
2023-04-14 16:25:50 +02:00
committed by GitHub
parent 0286ecea09
commit 780e26331d
12 changed files with 194 additions and 112 deletions
+10
View File
@@ -139,6 +139,16 @@ impl OwnedBytes {
self.advance(8);
u64::from_le_bytes(octlet)
}
/// Reads an `u32` encoded as little-endian from the `OwnedBytes` and advance by 4 bytes.
#[inline]
pub fn read_u32(&mut self) -> u32 {
assert!(self.len() > 3);
let quad: [u8; 4] = self.as_slice()[..4].try_into().unwrap();
self.advance(4);
u32::from_le_bytes(quad)
}
}
impl fmt::Debug for OwnedBytes {