Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWriter ¶
NewWriter returns a new pack.Writer that compresses data at the given level. Levels 0–9 are currently implemented. Levels outside this range will be replaced with the closest level available.
func Score ¶
func Score(m pack.AbsoluteMatch) int
Types ¶
type CompositeHasher ¶
type CompositeHasher struct {
A, B Hasher
}
A CompositeHasher wraps two Hashers and combines their output.
func (CompositeHasher) Candidates ¶
func (h CompositeHasher) Candidates(dst []int, data []byte, index int) []int
func (CompositeHasher) Init ¶
func (h CompositeHasher) Init()
func (CompositeHasher) Store ¶
func (h CompositeHasher) Store(data []byte, index int)
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder implements the pack.Encoder interface, writing in Brotli format.
type H2 ¶
type H2 struct {
// contains filtered or unexported fields
}
H2 is a Hasher similar to what the reference implementation of brotli uses for compression level 2.
type H3 ¶
type H3 struct {
// contains filtered or unexported fields
}
H3 is a Hasher similar to what the reference implementation of brotli uses for compression level 3.
type H4 ¶
type H4 struct {
// contains filtered or unexported fields
}
H4 is a Hasher similar to what the reference implementation of brotli uses for compression level 4.
type H5 ¶
type H5 struct { // BlockBits is the base-2 logarithm of the number of entries per hash // bucket. The reference implementation sets it to one less than the // compression level. BlockBits int // BucketBits is the base-2 logarithm of the number of hash buckets. // The reference implementation sets it to 14 or 15. BucketBits int // contains filtered or unexported fields }
H5 is a Hasher similar to what the reference implementation of brotli uses for compression levels 5–9.
type H6 ¶
type H6 struct { // BlockBits is the base-2 logarithm of the number of entries per hash // bucket. The reference implementation sets it to one less than the // compression level. BlockBits int // BucketBits is the base-2 logarithm of the number of hash buckets. // The reference implementation sets it to 14 or 15. BucketBits int // HashLen is the number of bytes to hash. The reference implementation // normally sets it to 5. HashLen int // contains filtered or unexported fields }
H6 is a Hasher similar to what the reference implementation of brotli uses for compression levels 5–9.
It is basically the same as H5, but with a configurable hash length.
type Hasher ¶
type Hasher interface { // Init allocates the Hasher's internal storage, or clears it if // it is already allocated. Init must be called before any of the other // methods. Init() // Store puts an entry in the hash table for the data at index. Store(data []byte, index int) // Candidates hashes the data at index, fetches a list of possible matches // from the hash table, and appends the list to dst. Candidates(dst []int, data []byte, index int) []int }
A Hasher maintains a hash table for finding backreferences in data.
type M0 ¶
type M0 struct { // Lazy turns on "lazy matching," for higher compression but less speed. Lazy bool MaxDistance int MaxLength int }
M0 is an implementation of the pack.MatchFinder interface based on the algorithm used by snappy, but modified to be more like the algorithm used by compression level 0 of the brotli reference implementation.
func (M0) FindMatches ¶
FindMatches looks for matches in src, appends them to dst, and returns dst. src must not be longer than 65536 bytes.
type MatchFinder ¶
type MatchFinder struct { Hasher Hasher // MaxLength is the limit on the length of matches to find; // 0 means unlimited. MaxLength int // MaxDistance is the limit on the distance to look back for matches; // 0 means unlimited. MaxDistance int // MaxHistory is the limit on how much data from previous blocks is // kept around to look for matches in; 0 means that no matches from previous // blocks will be found. MaxHistory int // MinHistory is the amount of data that is used to start a new history // buffer after the size exceeds MaxHistory. MinHistory int // contains filtered or unexported fields }
MatchFinder is an implementation of pack.MatchFinder that uses a Hasher to find matches.
func (*MatchFinder) FindMatches ¶
FindMatches looks for matches in src, appends them to dst, and returns dst.
func (*MatchFinder) Reset ¶
func (q *MatchFinder) Reset()