Files
EdgeNode/internal/compressions/reader_pool_zstd.go

26 lines
528 B
Go
Raw Normal View History

2022-06-27 22:40:36 +08:00
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package compressions
import (
2022-07-26 09:41:43 +08:00
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
2024-03-28 17:17:34 +08:00
memutils "github.com/TeaOSLab/EdgeNode/internal/utils/mem"
2022-06-27 22:40:36 +08:00
"io"
)
var sharedZSTDReaderPool *ReaderPool
func init() {
if !teaconst.IsMain {
2022-07-26 09:41:43 +08:00
return
}
2024-03-28 17:17:34 +08:00
var maxSize = memutils.SystemMemoryGB() * 256
2022-06-27 22:40:36 +08:00
if maxSize == 0 {
maxSize = 256
}
sharedZSTDReaderPool = NewReaderPool(maxSize, func(reader io.Reader) (Reader, error) {
return newZSTDReader(reader)
})
}