@@ -796,7 +796,7 @@ func makeLayoutWriter(w objstorage.Writable, opts WriterOptions) layoutWriter {
796
796
writable : w ,
797
797
cacheOpts : opts .internal .CacheOpts ,
798
798
tableFormat : opts .TableFormat ,
799
- compressor : block .MakeCompressor (opts .Compression ),
799
+ compressor : block .MakeCompressor (opts .Compression . ToProfile () ),
800
800
checksumType : opts .Checksum ,
801
801
buf : blockBuf {
802
802
checksummer : block.Checksummer {Type : opts .Checksum },
@@ -822,7 +822,7 @@ func (w *layoutWriter) Abort() {
822
822
// WriteDataBlock constructs a trailer for the provided data block and writes
823
823
// the block and trailer to the writer. It returns the block's handle.
824
824
func (w * layoutWriter ) WriteDataBlock (b []byte , buf * blockBuf ) (block.Handle , error ) {
825
- return w .writeBlock (b , & w .compressor , buf )
825
+ return w .writeBlock (b , blockkind . SSTableData , & w .compressor , buf )
826
826
}
827
827
828
828
// WritePrecompressedDataBlock writes a pre-compressed data block and its
@@ -837,7 +837,7 @@ func (w *layoutWriter) WritePrecompressedDataBlock(blk block.PhysicalBlock) (blo
837
837
// the last-written index block's handle and adds it to the file's meta index
838
838
// when the writer is finished.
839
839
func (w * layoutWriter ) WriteIndexBlock (b []byte ) (block.Handle , error ) {
840
- h , err := w .writeBlock (b , & w .compressor , & w .buf )
840
+ h , err := w .writeBlock (b , blockkind . SSTableIndex , & w .compressor , & w .buf )
841
841
if err == nil {
842
842
w .lastIndexBlockHandle = h
843
843
}
@@ -852,7 +852,7 @@ func (w *layoutWriter) WriteFilterBlock(f filterWriter) (bh block.Handle, err er
852
852
if err != nil {
853
853
return block.Handle {}, err
854
854
}
855
- return w .writeNamedBlock (b , block .NoopCompressor , f .metaName ())
855
+ return w .writeNamedBlock (b , blockkind . Filter , block .NoopCompressor , f .metaName ())
856
856
}
857
857
858
858
// WritePropertiesBlock constructs a trailer for the provided properties block
@@ -867,28 +867,28 @@ func (w *layoutWriter) WritePropertiesBlock(b []byte) (block.Handle, error) {
867
867
if w .tableFormat < TableFormatPebblev7 {
868
868
compressor = block .NoopCompressor
869
869
}
870
- return w .writeNamedBlock (b , compressor , metaPropertiesName )
870
+ return w .writeNamedBlock (b , blockkind . Metadata , compressor , metaPropertiesName )
871
871
}
872
872
873
873
// WriteRangeKeyBlock constructs a trailer for the provided range key block and
874
874
// writes the block and trailer to the writer. It automatically adds the range
875
875
// key block to the file's meta index when the writer is finished.
876
876
func (w * layoutWriter ) WriteRangeKeyBlock (b []byte ) (block.Handle , error ) {
877
- return w .writeNamedBlock (b , block .NoopCompressor , metaRangeKeyName )
877
+ return w .writeNamedBlock (b , blockkind . RangeKey , block .NoopCompressor , metaRangeKeyName )
878
878
}
879
879
880
880
// WriteRangeDeletionBlock constructs a trailer for the provided range deletion
881
881
// block and writes the block and trailer to the writer. It automatically adds
882
882
// the range deletion block to the file's meta index when the writer is
883
883
// finished.
884
884
func (w * layoutWriter ) WriteRangeDeletionBlock (b []byte ) (block.Handle , error ) {
885
- return w .writeNamedBlock (b , block .NoopCompressor , metaRangeDelV2Name )
885
+ return w .writeNamedBlock (b , blockkind . RangeDel , block .NoopCompressor , metaRangeDelV2Name )
886
886
}
887
887
888
888
func (w * layoutWriter ) writeNamedBlock (
889
- b []byte , compressor * block.Compressor , name string ,
889
+ b []byte , kind block. Kind , compressor * block.Compressor , name string ,
890
890
) (bh block.Handle , err error ) {
891
- bh , err = w .writeBlock (b , compressor , & w .buf )
891
+ bh , err = w .writeBlock (b , kind , compressor , & w .buf )
892
892
if err == nil {
893
893
w .recordToMetaindex (name , bh )
894
894
}
@@ -917,9 +917,9 @@ func (w *layoutWriter) WriteValueIndexBlock(
917
917
918
918
// writeBlock checksums, compresses, and writes out a block.
919
919
func (w * layoutWriter ) writeBlock (
920
- b []byte , compressor * block.Compressor , buf * blockBuf ,
920
+ b []byte , kind block. Kind , compressor * block.Compressor , buf * blockBuf ,
921
921
) (block.Handle , error ) {
922
- pb := block .CompressAndChecksum (& buf .dataBuf , b , compressor , & buf .checksummer )
922
+ pb := block .CompressAndChecksum (& buf .dataBuf , b , kind , compressor , & buf .checksummer )
923
923
h , err := w .writePrecompressedBlock (pb )
924
924
return h , err
925
925
}
@@ -1003,7 +1003,7 @@ func (w *layoutWriter) Finish() (size uint64, err error) {
1003
1003
}
1004
1004
b = bw .Finish ()
1005
1005
}
1006
- metaIndexHandle , err := w .writeBlock (b , block .NoopCompressor , & w .buf )
1006
+ metaIndexHandle , err := w .writeBlock (b , blockkind . Metadata , block .NoopCompressor , & w .buf )
1007
1007
if err != nil {
1008
1008
return 0 , err
1009
1009
}
0 commit comments