Documentation ¶
Overview ¶
Implementations for the interfaces provided by the 'policies' packages. Aka 'github.com/maxymania/fastnntp-polyglot/policies'. This package is meant to implement a more efficient and effective policies.DeflateFunction as well as more flexible and useful policies.
Index ¶
- func CreateSimpleAdaptiveDeflate(unCompressible, compressible, veryCompressible policies.DeflateFunction) policies.DeflateFunction
- func FastDeflate(d policies.DEFLATE, data []byte) []byte
- func HuffmanOnlyDeflate(d policies.DEFLATE, data []byte) []byte
- func NewDeflateFunction(level int) policies.DeflateFunction
- func ZopfliDeflate(d policies.DEFLATE, data []byte) []byte
- type AdaptiveDeflator
- type AdaptiveDeflatorConfig
- type Layer
- type LayerElement
- type Matcher
- type MatcherConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSimpleAdaptiveDeflate ¶
func CreateSimpleAdaptiveDeflate(unCompressible, compressible, veryCompressible policies.DeflateFunction) policies.DeflateFunction
Adaptive Compression function constructor. This produces an policies.DeflateFunction, that first estimates the compressibility of the data, and then, chooses an underlying compression function, depending on whether the data is Non-Compressible, Compressible or Very compressible.
func FastDeflate ¶
Fast policies.DeflateFunction
func HuffmanOnlyDeflate ¶
Very fast policies.DeflateFunction (llar).
func NewDeflateFunction ¶
func NewDeflateFunction(level int) policies.DeflateFunction
Faster alternaticve to policies.NewDeflateFunction(level int)
Types ¶
type AdaptiveDeflator ¶
type AdaptiveDeflator struct { // If not zero, this variable declares, how small a BLOB may be at least and how big it may be at most, // in order to archieve proper compression. CompressibleSize format.Range // The Maximum DELATE-Ratio, that might be used to compress the data. // This option is meant to limit the performance impact of large BLOBs. MaxRatio int // If true, the function will use HuffmanOnly instead of NoCompression for // non-compressible BLOBs. UseHuffmanInCase bool // If the data is compressible, add BoostRatio but don't exceed BoostMaxRatio BoostRatio, BoostMaxRatio int // If ZopfliMinSize <= len(data) <= ZopfliMaxSize AND len(data)!=0, then // the Zopfli Compression algorithm will be used instead of the regular // Deflate routines, thus resulting in much higher compression ratio. ZopfliMinSize, ZopfliMaxSize int // If the estimated compressibility is < ZopfliMinCompressibility, then // the Zopfli algorithm will not kick in. ZopfliMinCompressibility float64 }
Advanced adaptive DEFLATE encoder
type AdaptiveDeflatorConfig ¶
type AdaptiveDeflatorConfig struct { CompressibleSize format.Range `inn:"size"` MaxRatio int `inn:"ratio"` UseHuffmanInCase bool `inn:"nc-use-huffman"` BoostRatio format.Range `inn:"boost"` Zopfli struct { Size format.Range `inn:"size"` MinCompressibility float64 `inn:"compressible"` } `inn:"zopfli!"` }
func (*AdaptiveDeflatorConfig) Build ¶
func (cfg *AdaptiveDeflatorConfig) Build(ad *AdaptiveDeflator)
type Layer ¶
type Layer struct { Inner policies.PostingPolicy Element []LayerElement PerformAll bool }
type LayerElement ¶
type LayerElement struct {
Xover, Head, Body policies.DeflateFunction
ExpireDays int
Criteria *Matcher
}