@@ -32,16 +32,16 @@ import (
32
32
"github.com/grafana/loki/v3/pkg/util/filter"
33
33
)
34
34
35
- var testEncodings = []compression.Encoding {
36
- compression .EncNone ,
37
- compression .EncGZIP ,
38
- compression .EncLZ4_64k ,
39
- compression .EncLZ4_256k ,
40
- compression .EncLZ4_1M ,
41
- compression .EncLZ4_4M ,
42
- compression .EncSnappy ,
43
- compression .EncFlate ,
44
- compression .EncZstd ,
35
+ var testEncodings = []compression.Codec {
36
+ compression .None ,
37
+ compression .GZIP ,
38
+ compression .LZ4_64k ,
39
+ compression .LZ4_256k ,
40
+ compression .LZ4_1M ,
41
+ compression .LZ4_4M ,
42
+ compression .Snappy ,
43
+ compression .Flate ,
44
+ compression .Zstd ,
45
45
}
46
46
47
47
var (
@@ -299,7 +299,7 @@ func TestCorruptChunk(t *testing.T) {
299
299
func TestReadFormatV1 (t * testing.T ) {
300
300
t .Parallel ()
301
301
302
- c := NewMemChunk (ChunkFormatV3 , compression .EncGZIP , DefaultTestHeadBlockFmt , testBlockSize , testTargetSize )
302
+ c := NewMemChunk (ChunkFormatV3 , compression .GZIP , DefaultTestHeadBlockFmt , testBlockSize , testTargetSize )
303
303
fillChunk (c )
304
304
// overrides to v1 for testing that specific version.
305
305
c .format = ChunkFormatV1
@@ -391,7 +391,7 @@ func TestRoundtripV2(t *testing.T) {
391
391
}
392
392
}
393
393
394
- func testNameWithFormats (enc compression.Encoding , chunkFormat byte , headBlockFmt HeadBlockFmt ) string {
394
+ func testNameWithFormats (enc compression.Codec , chunkFormat byte , headBlockFmt HeadBlockFmt ) string {
395
395
return fmt .Sprintf ("encoding:%v chunkFormat:%v headBlockFmt:%v" , enc , chunkFormat , headBlockFmt )
396
396
}
397
397
@@ -558,7 +558,7 @@ func TestChunkFilling(t *testing.T) {
558
558
func TestGZIPChunkTargetSize (t * testing.T ) {
559
559
t .Parallel ()
560
560
561
- chk := NewMemChunk (ChunkFormatV3 , compression .EncGZIP , DefaultTestHeadBlockFmt , testBlockSize , testTargetSize )
561
+ chk := NewMemChunk (ChunkFormatV3 , compression .GZIP , DefaultTestHeadBlockFmt , testBlockSize , testTargetSize )
562
562
563
563
lineSize := 512
564
564
entry := & logproto.Entry {
@@ -681,7 +681,7 @@ func TestMemChunk_AppendOutOfOrder(t *testing.T) {
681
681
t .Run (testName , func (t * testing.T ) {
682
682
t .Parallel ()
683
683
684
- tester (t , NewMemChunk (ChunkFormatV3 , compression .EncGZIP , f , testBlockSize , testTargetSize ))
684
+ tester (t , NewMemChunk (ChunkFormatV3 , compression .GZIP , f , testBlockSize , testTargetSize ))
685
685
})
686
686
}
687
687
}
@@ -726,7 +726,7 @@ func TestChunkSize(t *testing.T) {
726
726
}
727
727
728
728
func TestChunkStats (t * testing.T ) {
729
- c := NewMemChunk (ChunkFormatV4 , compression .EncSnappy , DefaultTestHeadBlockFmt , testBlockSize , 0 )
729
+ c := NewMemChunk (ChunkFormatV4 , compression .Snappy , DefaultTestHeadBlockFmt , testBlockSize , 0 )
730
730
first := time .Now ()
731
731
entry := & logproto.Entry {
732
732
Timestamp : first ,
@@ -968,7 +968,7 @@ func BenchmarkBackwardIterator(b *testing.B) {
968
968
for _ , bs := range testBlockSizes {
969
969
b .Run (humanize .Bytes (uint64 (bs )), func (b * testing.B ) {
970
970
b .ReportAllocs ()
971
- c := NewMemChunk (ChunkFormatV4 , compression .EncSnappy , DefaultTestHeadBlockFmt , bs , testTargetSize )
971
+ c := NewMemChunk (ChunkFormatV4 , compression .Snappy , DefaultTestHeadBlockFmt , bs , testTargetSize )
972
972
_ = fillChunk (c )
973
973
b .ResetTimer ()
974
974
for n := 0 ; n < b .N ; n ++ {
@@ -1082,7 +1082,7 @@ func BenchmarkHeadBlockSampleIterator(b *testing.B) {
1082
1082
func TestMemChunk_IteratorBounds (t * testing.T ) {
1083
1083
createChunk := func () * MemChunk {
1084
1084
t .Helper ()
1085
- c := NewMemChunk (ChunkFormatV3 , compression .EncNone , DefaultTestHeadBlockFmt , 1e6 , 1e6 )
1085
+ c := NewMemChunk (ChunkFormatV3 , compression .None , DefaultTestHeadBlockFmt , 1e6 , 1e6 )
1086
1086
1087
1087
if _ , err := c .Append (& logproto.Entry {
1088
1088
Timestamp : time .Unix (0 , 1 ),
@@ -1168,9 +1168,9 @@ func TestMemchunkLongLine(t *testing.T) {
1168
1168
func TestBytesWith (t * testing.T ) {
1169
1169
t .Parallel ()
1170
1170
1171
- exp , err := NewMemChunk (ChunkFormatV3 , compression .EncNone , DefaultTestHeadBlockFmt , testBlockSize , testTargetSize ).BytesWith (nil )
1171
+ exp , err := NewMemChunk (ChunkFormatV3 , compression .None , DefaultTestHeadBlockFmt , testBlockSize , testTargetSize ).BytesWith (nil )
1172
1172
require .Nil (t , err )
1173
- out , err := NewMemChunk (ChunkFormatV3 , compression .EncNone , DefaultTestHeadBlockFmt , testBlockSize , testTargetSize ).BytesWith ([]byte {1 , 2 , 3 })
1173
+ out , err := NewMemChunk (ChunkFormatV3 , compression .None , DefaultTestHeadBlockFmt , testBlockSize , testTargetSize ).BytesWith ([]byte {1 , 2 , 3 })
1174
1174
require .Nil (t , err )
1175
1175
1176
1176
require .Equal (t , exp , out )
@@ -1181,8 +1181,8 @@ func TestCheckpointEncoding(t *testing.T) {
1181
1181
1182
1182
blockSize , targetSize := 256 * 1024 , 1500 * 1024
1183
1183
for _ , f := range allPossibleFormats {
1184
- t .Run (testNameWithFormats (compression .EncSnappy , f .chunkFormat , f .headBlockFmt ), func (t * testing.T ) {
1185
- c := newMemChunkWithFormat (f .chunkFormat , compression .EncSnappy , f .headBlockFmt , blockSize , targetSize )
1184
+ t .Run (testNameWithFormats (compression .Snappy , f .chunkFormat , f .headBlockFmt ), func (t * testing.T ) {
1185
+ c := newMemChunkWithFormat (f .chunkFormat , compression .Snappy , f .headBlockFmt , blockSize , targetSize )
1186
1186
1187
1187
// add a few entries
1188
1188
for i := 0 ; i < 5 ; i ++ {
@@ -1267,7 +1267,7 @@ var (
1267
1267
func BenchmarkBufferedIteratorLabels (b * testing.B ) {
1268
1268
for _ , f := range HeadBlockFmts {
1269
1269
b .Run (f .String (), func (b * testing.B ) {
1270
- c := NewMemChunk (ChunkFormatV3 , compression .EncSnappy , f , testBlockSize , testTargetSize )
1270
+ c := NewMemChunk (ChunkFormatV3 , compression .Snappy , f , testBlockSize , testTargetSize )
1271
1271
_ = fillChunk (c )
1272
1272
1273
1273
labelsSet := []labels.Labels {
@@ -1367,8 +1367,8 @@ func BenchmarkBufferedIteratorLabels(b *testing.B) {
1367
1367
1368
1368
func Test_HeadIteratorReverse (t * testing.T ) {
1369
1369
for _ , testData := range allPossibleFormats {
1370
- t .Run (testNameWithFormats (compression .EncSnappy , testData .chunkFormat , testData .headBlockFmt ), func (t * testing.T ) {
1371
- c := newMemChunkWithFormat (testData .chunkFormat , compression .EncSnappy , testData .headBlockFmt , testBlockSize , testTargetSize )
1370
+ t .Run (testNameWithFormats (compression .Snappy , testData .chunkFormat , testData .headBlockFmt ), func (t * testing.T ) {
1371
+ c := newMemChunkWithFormat (testData .chunkFormat , compression .Snappy , testData .headBlockFmt , testBlockSize , testTargetSize )
1372
1372
genEntry := func (i int64 ) * logproto.Entry {
1373
1373
return & logproto.Entry {
1374
1374
Timestamp : time .Unix (0 , i ),
@@ -1483,7 +1483,7 @@ func TestMemChunk_Rebound(t *testing.T) {
1483
1483
}
1484
1484
1485
1485
func buildTestMemChunk (t * testing.T , from , through time.Time ) * MemChunk {
1486
- chk := NewMemChunk (ChunkFormatV3 , compression .EncGZIP , DefaultTestHeadBlockFmt , defaultBlockSize , 0 )
1486
+ chk := NewMemChunk (ChunkFormatV3 , compression .GZIP , DefaultTestHeadBlockFmt , defaultBlockSize , 0 )
1487
1487
for ; from .Before (through ); from = from .Add (time .Second ) {
1488
1488
_ , err := chk .Append (& logproto.Entry {
1489
1489
Line : from .String (),
@@ -1604,7 +1604,7 @@ func TestMemChunk_ReboundAndFilter_with_filter(t *testing.T) {
1604
1604
}
1605
1605
1606
1606
func buildFilterableTestMemChunk (t * testing.T , from , through time.Time , matchingFrom , matchingTo * time.Time , withStructuredMetadata bool ) * MemChunk {
1607
- chk := NewMemChunk (ChunkFormatV4 , compression .EncGZIP , DefaultTestHeadBlockFmt , defaultBlockSize , 0 )
1607
+ chk := NewMemChunk (ChunkFormatV4 , compression .GZIP , DefaultTestHeadBlockFmt , defaultBlockSize , 0 )
1608
1608
t .Logf ("from : %v" , from .String ())
1609
1609
t .Logf ("through: %v" , through .String ())
1610
1610
var structuredMetadata push.LabelsAdapter
@@ -1753,7 +1753,7 @@ func TestMemChunk_SpaceFor(t *testing.T) {
1753
1753
t .Run (tc .desc , func (t * testing.T ) {
1754
1754
for _ , format := range allPossibleFormats {
1755
1755
t .Run (fmt .Sprintf ("chunk_v%d_head_%s" , format .chunkFormat , format .headBlockFmt ), func (t * testing.T ) {
1756
- chk := newMemChunkWithFormat (format .chunkFormat , compression .EncNone , format .headBlockFmt , 1024 , tc .targetSize )
1756
+ chk := newMemChunkWithFormat (format .chunkFormat , compression .None , format .headBlockFmt , 1024 , tc .targetSize )
1757
1757
1758
1758
chk .blocks = make ([]block , tc .nBlocks )
1759
1759
chk .cutBlockSize = tc .cutBlockSize
@@ -2055,7 +2055,7 @@ func TestDecodeChunkIncorrectBlockOffset(t *testing.T) {
2055
2055
t .Run (fmt .Sprintf ("chunkFormat:%v headBlockFmt:%v" , format .chunkFormat , format .headBlockFmt ), func (t * testing.T ) {
2056
2056
for incorrectOffsetBlockNum := 0 ; incorrectOffsetBlockNum < 3 ; incorrectOffsetBlockNum ++ {
2057
2057
t .Run (fmt .Sprintf ("inorrect offset block: %d" , incorrectOffsetBlockNum ), func (t * testing.T ) {
2058
- chk := NewMemChunk (format .chunkFormat , compression .EncNone , format .headBlockFmt , blockSize , testTargetSize )
2058
+ chk := NewMemChunk (format .chunkFormat , compression .None , format .headBlockFmt , blockSize , testTargetSize )
2059
2059
ts := time .Now ().Unix ()
2060
2060
for i := 0 ; i < 3 ; i ++ {
2061
2061
dup , err := chk .Append (& logproto.Entry {
0 commit comments