VOL-1967 move api-server to separate repository
Current with voltha-go acf0adaf2d91ae72b55192cc8a939e0485918d16
Change-Id: I000ea6be0789e20c922bd671562b58a7120892ae
diff --git a/vendor/github.com/eapache/go-xerial-snappy/.gitignore b/vendor/github.com/eapache/go-xerial-snappy/.gitignore
new file mode 100644
index 0000000..daf913b
--- /dev/null
+++ b/vendor/github.com/eapache/go-xerial-snappy/.gitignore
@@ -0,0 +1,24 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
diff --git a/vendor/github.com/eapache/go-xerial-snappy/.travis.yml b/vendor/github.com/eapache/go-xerial-snappy/.travis.yml
new file mode 100644
index 0000000..d6cf4f1
--- /dev/null
+++ b/vendor/github.com/eapache/go-xerial-snappy/.travis.yml
@@ -0,0 +1,7 @@
+language: go
+
+go:
+- 1.5.4
+- 1.6.1
+
+sudo: false
diff --git a/vendor/github.com/eapache/go-xerial-snappy/LICENSE b/vendor/github.com/eapache/go-xerial-snappy/LICENSE
new file mode 100644
index 0000000..5bf3688
--- /dev/null
+++ b/vendor/github.com/eapache/go-xerial-snappy/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 Evan Huus
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/eapache/go-xerial-snappy/README.md b/vendor/github.com/eapache/go-xerial-snappy/README.md
new file mode 100644
index 0000000..3f2695c
--- /dev/null
+++ b/vendor/github.com/eapache/go-xerial-snappy/README.md
@@ -0,0 +1,13 @@
+# go-xerial-snappy
+
+[![Build Status](https://travis-ci.org/eapache/go-xerial-snappy.svg?branch=master)](https://travis-ci.org/eapache/go-xerial-snappy)
+
+Xerial-compatible Snappy framing support for golang.
+
+Packages using Xerial for snappy encoding use a framing format incompatible with
+basically everything else in existence. This package wraps Go's built-in snappy
+package to support it.
+
+Apps that use this format include Apache Kafka (see
+https://github.com/dpkp/kafka-python/issues/126#issuecomment-35478921 for
+details).
diff --git a/vendor/github.com/eapache/go-xerial-snappy/fuzz.go b/vendor/github.com/eapache/go-xerial-snappy/fuzz.go
new file mode 100644
index 0000000..6a46f47
--- /dev/null
+++ b/vendor/github.com/eapache/go-xerial-snappy/fuzz.go
@@ -0,0 +1,16 @@
+// +build gofuzz
+
+package snappy
+
+func Fuzz(data []byte) int {
+ decode, err := Decode(data)
+ if decode == nil && err == nil {
+ panic("nil error with nil result")
+ }
+
+ if err != nil {
+ return 0
+ }
+
+ return 1
+}
diff --git a/vendor/github.com/eapache/go-xerial-snappy/snappy.go b/vendor/github.com/eapache/go-xerial-snappy/snappy.go
new file mode 100644
index 0000000..ea8f7af
--- /dev/null
+++ b/vendor/github.com/eapache/go-xerial-snappy/snappy.go
@@ -0,0 +1,131 @@
+package snappy
+
+import (
+ "bytes"
+ "encoding/binary"
+ "errors"
+
+ master "github.com/golang/snappy"
+)
+
+const (
+ sizeOffset = 16
+ sizeBytes = 4
+)
+
+var (
+ xerialHeader = []byte{130, 83, 78, 65, 80, 80, 89, 0}
+
+ // This is xerial version 1 and minimally compatible with version 1
+ xerialVersionInfo = []byte{0, 0, 0, 1, 0, 0, 0, 1}
+
+ // ErrMalformed is returned by the decoder when the xerial framing
+ // is malformed
+ ErrMalformed = errors.New("malformed xerial framing")
+)
+
+func min(x, y int) int {
+ if x < y {
+ return x
+ }
+ return y
+}
+
+// Encode encodes data as snappy with no framing header.
+func Encode(src []byte) []byte {
+ return master.Encode(nil, src)
+}
+
+// EncodeStream *appends* to the specified 'dst' the compressed
+// 'src' in xerial framing format. If 'dst' does not have enough
+// capacity, then a new slice will be allocated. If 'dst' has
+// non-zero length, then if *must* have been built using this function.
+func EncodeStream(dst, src []byte) []byte {
+ if len(dst) == 0 {
+ dst = append(dst, xerialHeader...)
+ dst = append(dst, xerialVersionInfo...)
+ }
+
+ // Snappy encode in blocks of maximum 32KB
+ var (
+ max = len(src)
+ blockSize = 32 * 1024
+ pos = 0
+ chunk []byte
+ )
+
+ for pos < max {
+ newPos := min(pos + blockSize, max)
+ chunk = master.Encode(chunk[:cap(chunk)], src[pos:newPos])
+
+ // First encode the compressed size (big-endian)
+ // Put* panics if the buffer is too small, so pad 4 bytes first
+ origLen := len(dst)
+ dst = append(dst, dst[0:4]...)
+ binary.BigEndian.PutUint32(dst[origLen:], uint32(len(chunk)))
+
+ // And now the compressed data
+ dst = append(dst, chunk...)
+ pos = newPos
+ }
+ return dst
+}
+
+// Decode decodes snappy data whether it is traditional unframed
+// or includes the xerial framing format.
+func Decode(src []byte) ([]byte, error) {
+ return DecodeInto(nil, src)
+}
+
+// DecodeInto decodes snappy data whether it is traditional unframed
+// or includes the xerial framing format into the specified `dst`.
+// It is assumed that the entirety of `dst` including all capacity is available
+// for use by this function. If `dst` is nil *or* insufficiently large to hold
+// the decoded `src`, new space will be allocated.
+func DecodeInto(dst, src []byte) ([]byte, error) {
+ var max = len(src)
+ if max < len(xerialHeader) {
+ return nil, ErrMalformed
+ }
+
+ if !bytes.Equal(src[:8], xerialHeader) {
+ return master.Decode(dst[:cap(dst)], src)
+ }
+
+ if max < sizeOffset+sizeBytes {
+ return nil, ErrMalformed
+ }
+
+ if dst == nil {
+ dst = make([]byte, 0, len(src))
+ }
+
+ dst = dst[:0]
+ var (
+ pos = sizeOffset
+ chunk []byte
+ err error
+ )
+
+ for pos+sizeBytes <= max {
+ size := int(binary.BigEndian.Uint32(src[pos : pos+sizeBytes]))
+ pos += sizeBytes
+
+ nextPos := pos + size
+ // On architectures where int is 32-bytes wide size + pos could
+ // overflow so we need to check the low bound as well as the
+ // high
+ if nextPos < pos || nextPos > max {
+ return nil, ErrMalformed
+ }
+
+ chunk, err = master.Decode(chunk[:cap(chunk)], src[pos:nextPos])
+
+ if err != nil {
+ return nil, err
+ }
+ pos = nextPos
+ dst = append(dst, chunk...)
+ }
+ return dst, nil
+}