@@ -26,18 +26,12 @@ use smallvec::SmallVec;
2626use spacetimedb_lib:: { ConnectionId , Identity , TimeDuration , Timestamp } ;
2727use spacetimedb_primitives:: TableId ;
2828use spacetimedb_sats:: {
29- bsatn,
3029 de:: { Deserialize , Error } ,
3130 impl_deserialize, impl_serialize, impl_st,
3231 ser:: Serialize ,
3332 AlgebraicType , SpacetimeType ,
3433} ;
35- use std:: {
36- io:: { self , Read as _} ,
37- sync:: Arc ,
38- } ;
39-
40- pub use crate :: websocket_building:: * ;
34+ use std:: sync:: Arc ;
4135
4236pub const TEXT_PROTOCOL : & str = "v1.json.spacetimedb" ;
4337pub const BIN_PROTOCOL : & str = "v1.bsatn.spacetimedb" ;
@@ -661,22 +655,6 @@ pub enum CompressableQueryUpdate<F: WebsocketFormat> {
661655 Gzip ( Bytes ) ,
662656}
663657
664- impl CompressableQueryUpdate < BsatnFormat > {
665- pub fn maybe_decompress ( self ) -> QueryUpdate < BsatnFormat > {
666- match self {
667- Self :: Uncompressed ( qu) => qu,
668- Self :: Brotli ( bytes) => {
669- let bytes = brotli_decompress ( & bytes) . unwrap ( ) ;
670- bsatn:: from_slice ( & bytes) . unwrap ( )
671- }
672- Self :: Gzip ( bytes) => {
673- let bytes = gzip_decompress ( & bytes) . unwrap ( ) ;
674- bsatn:: from_slice ( & bytes) . unwrap ( )
675- }
676- }
677- }
678- }
679-
680658#[ derive( SpacetimeType , Debug , Clone ) ]
681659#[ sats( crate = spacetimedb_lib) ]
682660pub struct QueryUpdate < F : WebsocketFormat > {
@@ -777,18 +755,6 @@ pub enum Compression {
777755 Gzip ,
778756}
779757
780- pub fn brotli_decompress ( bytes : & [ u8 ] ) -> Result < Vec < u8 > , io:: Error > {
781- let mut decompressed = Vec :: new ( ) ;
782- brotli:: BrotliDecompress ( & mut & bytes[ ..] , & mut decompressed) ?;
783- Ok ( decompressed)
784- }
785-
786- pub fn gzip_decompress ( bytes : & [ u8 ] ) -> Result < Vec < u8 > , io:: Error > {
787- let mut decompressed = Vec :: new ( ) ;
788- let _ = flate2:: read:: GzDecoder :: new ( bytes) . read_to_end ( & mut decompressed) ?;
789- Ok ( decompressed)
790- }
791-
792758pub type RowSize = u16 ;
793759pub type RowOffset = u64 ;
794760
0 commit comments