Update apache/thrift to 0.11.0 and remove pinning (#1317)

The `apache/thrift` recently released a new version of `0.11.0`
several days ago. This release is compatible with other packages
and as such, there is no need to pinning the `apache/thrift`
to `master` anymore in Gopkg.toml.

This fix removes the pinning of `apache/thrift` in Gopkg.toml,
and updates all dependencies of coredns.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2017-12-18 11:50:56 -06:00
committed by GitHub
parent ba4e77672c
commit 4dd40a292c
6992 changed files with 30842 additions and 1995023 deletions

View File

@@ -1,21 +0,0 @@
package xxHash64_test
import (
"bytes"
"fmt"
"github.com/pierrec/xxHash/xxHash64"
)
func ExampleNew() {
buf := bytes.NewBufferString("this is a test")
x := xxHash64.New(0xCAFE)
x.Write(buf.Bytes())
fmt.Printf("%x\n", x.Sum64())
// Output: 4228c3215949e862
}
func ExampleChecksum() {
buf := bytes.NewBufferString("this is a test")
fmt.Printf("%x\n", xxHash64.Checksum(buf.Bytes(), 0xCAFE))
// Output: 4228c3215949e862
}

View File

@@ -1,249 +0,0 @@
// Package xxHash64 implements the very fast xxHash hashing algorithm (64 bits version).
// (https://github.com/Cyan4973/xxHash/)
package xxHash64
import "hash"
const (
prime64_1 = 11400714785074694791
prime64_2 = 14029467366897019727
prime64_3 = 1609587929392839161
prime64_4 = 9650029242287828579
prime64_5 = 2870177450012600261
)
type xxHash struct {
seed uint64
v1 uint64
v2 uint64
v3 uint64
v4 uint64
totalLen uint64
buf [32]byte
bufused int
}
// New returns a new Hash64 instance.
func New(seed uint64) hash.Hash64 {
xxh := &xxHash{seed: seed}
xxh.Reset()
return xxh
}
// Sum appends the current hash to b and returns the resulting slice.
// It does not change the underlying hash state.
func (xxh xxHash) Sum(b []byte) []byte {
h64 := xxh.Sum64()
return append(b, byte(h64), byte(h64>>8), byte(h64>>16), byte(h64>>24), byte(h64>>32), byte(h64>>40), byte(h64>>48), byte(h64>>56))
}
// Reset resets the Hash to its initial state.
func (xxh *xxHash) Reset() {
xxh.v1 = xxh.seed + prime64_1 + prime64_2
xxh.v2 = xxh.seed + prime64_2
xxh.v3 = xxh.seed
xxh.v4 = xxh.seed - prime64_1
xxh.totalLen = 0
xxh.bufused = 0
}
// Size returns the number of bytes returned by Sum().
func (xxh *xxHash) Size() int {
return 8
}
// BlockSize gives the minimum number of bytes accepted by Write().
func (xxh *xxHash) BlockSize() int {
return 1
}
// Write adds input bytes to the Hash.
// It never returns an error.
func (xxh *xxHash) Write(input []byte) (int, error) {
n := len(input)
m := xxh.bufused
xxh.totalLen += uint64(n)
r := len(xxh.buf) - m
if n < r {
copy(xxh.buf[m:], input)
xxh.bufused += len(input)
return n, nil
}
p := 0
if m > 0 {
// some data left from previous update
copy(xxh.buf[xxh.bufused:], input[:r])
xxh.bufused += len(input) - r
// fast rotl(31)
p64 := xxh.v1 + (uint64(xxh.buf[p+7])<<56|uint64(xxh.buf[p+6])<<48|uint64(xxh.buf[p+5])<<40|uint64(xxh.buf[p+4])<<32|uint64(xxh.buf[p+3])<<24|uint64(xxh.buf[p+2])<<16|uint64(xxh.buf[p+1])<<8|uint64(xxh.buf[p]))*prime64_2
xxh.v1 = (p64<<31 | p64>>33) * prime64_1
p += 8
p64 = xxh.v2 + (uint64(xxh.buf[p+7])<<56|uint64(xxh.buf[p+6])<<48|uint64(xxh.buf[p+5])<<40|uint64(xxh.buf[p+4])<<32|uint64(xxh.buf[p+3])<<24|uint64(xxh.buf[p+2])<<16|uint64(xxh.buf[p+1])<<8|uint64(xxh.buf[p]))*prime64_2
xxh.v2 = (p64<<31 | p64>>33) * prime64_1
p += 8
p64 = xxh.v3 + (uint64(xxh.buf[p+7])<<56|uint64(xxh.buf[p+6])<<48|uint64(xxh.buf[p+5])<<40|uint64(xxh.buf[p+4])<<32|uint64(xxh.buf[p+3])<<24|uint64(xxh.buf[p+2])<<16|uint64(xxh.buf[p+1])<<8|uint64(xxh.buf[p]))*prime64_2
xxh.v3 = (p64<<31 | p64>>33) * prime64_1
p += 8
p64 = xxh.v4 + (uint64(xxh.buf[p+7])<<56|uint64(xxh.buf[p+6])<<48|uint64(xxh.buf[p+5])<<40|uint64(xxh.buf[p+4])<<32|uint64(xxh.buf[p+3])<<24|uint64(xxh.buf[p+2])<<16|uint64(xxh.buf[p+1])<<8|uint64(xxh.buf[p]))*prime64_2
xxh.v4 = (p64<<31 | p64>>33) * prime64_1
p = r
xxh.bufused = 0
}
for n := n - 32; p <= n; {
p64 := xxh.v1 + (uint64(input[p+7])<<56|uint64(input[p+6])<<48|uint64(input[p+5])<<40|uint64(input[p+4])<<32|uint64(input[p+3])<<24|uint64(input[p+2])<<16|uint64(input[p+1])<<8|uint64(input[p]))*prime64_2
xxh.v1 = (p64<<31 | p64>>33) * prime64_1
p += 8
p64 = xxh.v2 + (uint64(input[p+7])<<56|uint64(input[p+6])<<48|uint64(input[p+5])<<40|uint64(input[p+4])<<32|uint64(input[p+3])<<24|uint64(input[p+2])<<16|uint64(input[p+1])<<8|uint64(input[p]))*prime64_2
xxh.v2 = (p64<<31 | p64>>33) * prime64_1
p += 8
p64 = xxh.v3 + (uint64(input[p+7])<<56|uint64(input[p+6])<<48|uint64(input[p+5])<<40|uint64(input[p+4])<<32|uint64(input[p+3])<<24|uint64(input[p+2])<<16|uint64(input[p+1])<<8|uint64(input[p]))*prime64_2
xxh.v3 = (p64<<31 | p64>>33) * prime64_1
p += 8
p64 = xxh.v4 + (uint64(input[p+7])<<56|uint64(input[p+6])<<48|uint64(input[p+5])<<40|uint64(input[p+4])<<32|uint64(input[p+3])<<24|uint64(input[p+2])<<16|uint64(input[p+1])<<8|uint64(input[p]))*prime64_2
xxh.v4 = (p64<<31 | p64>>33) * prime64_1
p += 8
}
copy(xxh.buf[xxh.bufused:], input[p:])
xxh.bufused += len(input) - p
return n, nil
}
// Sum64 returns the 64bits Hash value.
func (xxh *xxHash) Sum64() uint64 {
var h64 uint64
if xxh.totalLen >= 32 {
h64 = ((xxh.v1 << 1) | (xxh.v1 >> 63)) +
((xxh.v2 << 7) | (xxh.v2 >> 57)) +
((xxh.v3 << 12) | (xxh.v3 >> 52)) +
((xxh.v4 << 18) | (xxh.v4 >> 46))
xxh.v1 *= prime64_2
h64 ^= ((xxh.v1 << 31) | (xxh.v1 >> 33)) * prime64_1
h64 = h64*prime64_1 + prime64_4
xxh.v2 *= prime64_2
h64 ^= ((xxh.v2 << 31) | (xxh.v2 >> 33)) * prime64_1
h64 = h64*prime64_1 + prime64_4
xxh.v3 *= prime64_2
h64 ^= ((xxh.v3 << 31) | (xxh.v3 >> 33)) * prime64_1
h64 = h64*prime64_1 + prime64_4
xxh.v4 *= prime64_2
h64 ^= ((xxh.v4 << 31) | (xxh.v4 >> 33)) * prime64_1
h64 = h64*prime64_1 + prime64_4 + xxh.totalLen
} else {
h64 = xxh.seed + prime64_5 + xxh.totalLen
}
p := 0
n := xxh.bufused
for n := n - 8; p <= n; p += 8 {
p64 := (uint64(xxh.buf[p+7])<<56 | uint64(xxh.buf[p+6])<<48 | uint64(xxh.buf[p+5])<<40 | uint64(xxh.buf[p+4])<<32 | uint64(xxh.buf[p+3])<<24 | uint64(xxh.buf[p+2])<<16 | uint64(xxh.buf[p+1])<<8 | uint64(xxh.buf[p])) * prime64_2
h64 ^= ((p64 << 31) | (p64 >> 33)) * prime64_1
h64 = ((h64<<27)|(h64>>37))*prime64_1 + prime64_4
}
if p+4 <= n {
h64 ^= (uint64(xxh.buf[p+3])<<24 | uint64(xxh.buf[p+2])<<16 | uint64(xxh.buf[p+1])<<8 | uint64(xxh.buf[p])) * prime64_1
h64 = ((h64<<23)|(h64>>41))*prime64_2 + prime64_3
p += 4
}
for ; p < n; p++ {
h64 ^= uint64(xxh.buf[p]) * prime64_5
h64 = ((h64 << 11) | (h64 >> 53)) * prime64_1
}
h64 ^= h64 >> 33
h64 *= prime64_2
h64 ^= h64 >> 29
h64 *= prime64_3
h64 ^= h64 >> 32
return h64
}
// Checksum returns the 64bits Hash value.
func Checksum(input []byte, seed uint64) uint64 {
n := len(input)
var h64 uint64
if n >= 32 {
v1 := seed + prime64_1 + prime64_2
v2 := seed + prime64_2
v3 := seed
v4 := seed - prime64_1
p := 0
for n := n - 32; p <= n; {
p64 := v1 + (uint64(input[p+7])<<56|uint64(input[p+6])<<48|uint64(input[p+5])<<40|uint64(input[p+4])<<32|uint64(input[p+3])<<24|uint64(input[p+2])<<16|uint64(input[p+1])<<8|uint64(input[p]))*prime64_2
v1 = (p64<<31 | p64>>33) * prime64_1
p += 8
p64 = v2 + (uint64(input[p+7])<<56|uint64(input[p+6])<<48|uint64(input[p+5])<<40|uint64(input[p+4])<<32|uint64(input[p+3])<<24|uint64(input[p+2])<<16|uint64(input[p+1])<<8|uint64(input[p]))*prime64_2
v2 = (p64<<31 | p64>>33) * prime64_1
p += 8
p64 = v3 + (uint64(input[p+7])<<56|uint64(input[p+6])<<48|uint64(input[p+5])<<40|uint64(input[p+4])<<32|uint64(input[p+3])<<24|uint64(input[p+2])<<16|uint64(input[p+1])<<8|uint64(input[p]))*prime64_2
v3 = (p64<<31 | p64>>33) * prime64_1
p += 8
p64 = v4 + (uint64(input[p+7])<<56|uint64(input[p+6])<<48|uint64(input[p+5])<<40|uint64(input[p+4])<<32|uint64(input[p+3])<<24|uint64(input[p+2])<<16|uint64(input[p+1])<<8|uint64(input[p]))*prime64_2
v4 = (p64<<31 | p64>>33) * prime64_1
p += 8
}
h64 = ((v1 << 1) | (v1 >> 63)) +
((v2 << 7) | (v2 >> 57)) +
((v3 << 12) | (v3 >> 52)) +
((v4 << 18) | (v4 >> 46))
v1 *= prime64_2
h64 ^= ((v1 << 31) | (v1 >> 33)) * prime64_1
h64 = h64*prime64_1 + prime64_4
v2 *= prime64_2
h64 ^= ((v2 << 31) | (v2 >> 33)) * prime64_1
h64 = h64*prime64_1 + prime64_4
v3 *= prime64_2
h64 ^= ((v3 << 31) | (v3 >> 33)) * prime64_1
h64 = h64*prime64_1 + prime64_4
v4 *= prime64_2
h64 ^= ((v4 << 31) | (v4 >> 33)) * prime64_1
h64 = h64*prime64_1 + prime64_4 + uint64(n)
input = input[p:]
n -= p
} else {
h64 = seed + prime64_5 + uint64(n)
}
p := 0
for n := n - 8; p <= n; p += 8 {
p64 := (uint64(input[p+7])<<56 | uint64(input[p+6])<<48 | uint64(input[p+5])<<40 | uint64(input[p+4])<<32 | uint64(input[p+3])<<24 | uint64(input[p+2])<<16 | uint64(input[p+1])<<8 | uint64(input[p])) * prime64_2
h64 ^= ((p64 << 31) | (p64 >> 33)) * prime64_1
h64 = ((h64<<27)|(h64>>37))*prime64_1 + prime64_4
}
if p+4 <= n {
h64 ^= (uint64(input[p+3])<<24 | uint64(input[p+2])<<16 | uint64(input[p+1])<<8 | uint64(input[p])) * prime64_1
h64 = ((h64<<23)|(h64>>41))*prime64_2 + prime64_3
p += 4
}
for ; p < n; p++ {
h64 ^= uint64(input[p]) * prime64_5
h64 = ((h64 << 11) | (h64 >> 53)) * prime64_1
}
h64 ^= h64 >> 33
h64 *= prime64_2
h64 ^= h64 >> 29
h64 *= prime64_3
h64 ^= h64 >> 32
return h64
}

View File

@@ -1,150 +0,0 @@
package xxHash64_test
import (
"encoding/binary"
"hash/crc64"
"hash/fnv"
"testing"
"github.com/pierrec/xxHash/xxHash64"
)
type test struct {
sum uint64
data, printable string
}
var testdata = []test{
{0xef46db3751d8e999, "", ""},
{0xd24ec4f1a98c6e5b, "a", ""},
{0x65f708ca92d04a61, "ab", ""},
{0x44bc2cf5ad770999, "abc", ""},
{0xde0327b0d25d92cc, "abcd", ""},
{0x07e3670c0c8dc7eb, "abcde", ""},
{0xfa8afd82c423144d, "abcdef", ""},
{0x1860940e2902822d, "abcdefg", ""},
{0x3ad351775b4634b7, "abcdefgh", ""},
{0x27f1a34fdbb95e13, "abcdefghi", ""},
{0xd6287a1de5498bb2, "abcdefghij", ""},
{0xbf2cd639b4143b80, "abcdefghijklmnopqrstuvwxyz012345", ""},
{0x64f23ecf1609b766, "abcdefghijklmnopqrstuvwxyz0123456789", ""},
{0xc5a8b11443765630, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", ""},
}
func init() {
for i := range testdata {
d := &testdata[i]
if len(d.data) > 20 {
d.printable = d.data[:20]
} else {
d.printable = d.data
}
}
}
func TestBlockSize(t *testing.T) {
xxh := xxHash64.New(0)
if s := xxh.BlockSize(); s <= 0 {
t.Errorf("invalid BlockSize: %d", s)
}
}
func TestSize(t *testing.T) {
xxh := xxHash64.New(0)
if s := xxh.Size(); s != 8 {
t.Errorf("invalid Size: got %d expected 8", s)
}
}
func TestData(t *testing.T) {
for i, td := range testdata {
xxh := xxHash64.New(0)
data := []byte(td.data)
xxh.Write(data)
if h := xxh.Sum64(); h != td.sum {
t.Errorf("test %d: xxh64(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
t.FailNow()
}
if h := xxHash64.Checksum(data, 0); h != td.sum {
t.Errorf("test %d: xxh64(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
t.FailNow()
}
}
}
func TestSplitData(t *testing.T) {
for i, td := range testdata {
xxh := xxHash64.New(0)
data := []byte(td.data)
l := len(data) / 2
xxh.Write(data[0:l])
xxh.Write(data[l:])
h := xxh.Sum64()
if h != td.sum {
t.Errorf("test %d: xxh64(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
t.FailNow()
}
}
}
func TestSum(t *testing.T) {
for i, td := range testdata {
xxh := xxHash64.New(0)
data := []byte(td.data)
xxh.Write(data)
b := xxh.Sum(data)
if h := binary.LittleEndian.Uint64(b[len(data):]); h != td.sum {
t.Errorf("test %d: xxh64(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
t.FailNow()
}
}
}
func TestReset(t *testing.T) {
xxh := xxHash64.New(0)
for i, td := range testdata {
xxh.Write([]byte(td.data))
h := xxh.Sum64()
if h != td.sum {
t.Errorf("test %d: xxh64(%s)=0x%x expected 0x%x", i, td.printable, h, td.sum)
t.FailNow()
}
xxh.Reset()
}
}
///////////////////////////////////////////////////////////////////////////////
// Benchmarks
//
var testdata1 = []byte(testdata[len(testdata)-1].data)
func Benchmark_XXH64(b *testing.B) {
h := xxHash64.New(0)
for n := 0; n < b.N; n++ {
h.Write(testdata1)
h.Sum64()
h.Reset()
}
}
func Benchmark_XXH64_Checksum(b *testing.B) {
for n := 0; n < b.N; n++ {
xxHash64.Checksum(testdata1, 0)
}
}
func Benchmark_CRC64(b *testing.B) {
t := crc64.MakeTable(0)
for i := 0; i < b.N; i++ {
crc64.Checksum(testdata1, t)
}
}
func Benchmark_Fnv64(b *testing.B) {
h := fnv.New64()
for i := 0; i < b.N; i++ {
h.Write(testdata1)
h.Sum64()
h.Reset()
}
}

View File

@@ -1,44 +0,0 @@
// Command line interface to the xxHash32 and xxHash64 packages.
// Usage:
// xxHash [-mode 0] [-seed 123] filename1 [filename2...]
// where
// mode: hash mode (0=32bits, 1=64bits) (default=1)
// seed: seed to be used (default=0)
package main
import (
"flag"
"fmt"
"hash"
"io"
"os"
"github.com/pierrec/xxHash/xxHash32"
"github.com/pierrec/xxHash/xxHash64"
)
func main() {
seed := flag.Uint64("seed", 0, "seed value")
mode := flag.Int("mode", 1, "hash mode: 0=32bits, 1=64bits")
flag.Parse()
var xxh hash.Hash
if *mode == 0 {
xxh = xxHash32.New(uint32(*seed))
} else {
xxh = xxHash64.New(*seed)
}
// Process each file in sequence
for _, filename := range flag.Args() {
inputFile, err := os.Open(filename)
if err != nil {
continue
}
if _, err := io.Copy(xxh, inputFile); err == nil {
fmt.Printf("%x %s\n", xxh.Sum(nil), filename)
}
inputFile.Close()
xxh.Reset()
}
}