@@ -4,8 +4,8 @@ use std::{
44} ;
55
66use log:: { debug, warn} ;
7- use spacetimedb_fs_utils :: compression :: Zstd ;
8- pub use spacetimedb_fs_utils:: compression:: { CompressOnce , CompressionStats } ;
7+
8+ pub use spacetimedb_fs_utils:: compression:: CompressionStats ;
99
1010use crate :: {
1111 commit:: Commit ,
@@ -123,13 +123,7 @@ pub trait Repo: Clone + fmt::Display {
123123 fn remove_segment ( & self , offset : u64 ) -> io:: Result < ( ) > ;
124124
125125 /// Compress a segment in storage, marking it as immutable.
126- fn compress_segment ( & self , offset : u64 ) -> io:: Result < CompressionStats > {
127- self . compress_segment_with ( offset, segment_compressor ( ) )
128- }
129-
130- /// Compress a segment using a supplied [CompressOnce], marking it as
131- /// immutable.
132- fn compress_segment_with ( & self , offset : u64 , f : impl CompressOnce ) -> io:: Result < CompressionStats > ;
126+ fn compress_segment ( & self , offset : u64 ) -> io:: Result < CompressionStats > ;
133127
134128 /// Traverse all segments in this repository and return list of their
135129 /// offsets, sorted in ascending order.
@@ -172,8 +166,8 @@ impl<T: Repo> Repo for &T {
172166 T :: remove_segment ( self , offset)
173167 }
174168
175- fn compress_segment_with ( & self , offset : u64 , f : impl CompressOnce ) -> io:: Result < CompressionStats > {
176- T :: compress_segment_with ( self , offset, f )
169+ fn compress_segment ( & self , offset : u64 ) -> io:: Result < CompressionStats > {
170+ T :: compress_segment ( self , offset)
177171 }
178172
179173 fn existing_offsets ( & self ) -> io:: Result < Vec < u64 > > {
@@ -362,17 +356,6 @@ pub fn open_segment_reader<R: Repo>(
362356 . map_err ( |source| with_segment_context ( "reading segment header" , repo, offset, source) )
363357}
364358
365- /// Obtain the canonical [CompressOnce] compressor for segments.
366- ///
367- /// The compressor will create seekable [Zstd] archives with a max frame size
368- /// of 4KiB. That is, seeking to an arbitrary byte offset (of the uncompressed
369- /// segment) within the archive will decompress 4KiB of data on average.
370- pub fn segment_compressor ( ) -> Zstd {
371- Zstd {
372- max_frame_size : Some ( 0x1000 ) ,
373- }
374- }
375-
376359fn segment_label < R : Repo > ( repo : & R , offset : u64 ) -> String {
377360 repo. segment_file_path ( offset)
378361 . unwrap_or_else ( || format ! ( "offset {offset}" ) )
0 commit comments