update cadvisor to v0.31.0
This commit is contained in:
33
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/BUILD
generated
vendored
Normal file
33
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/BUILD
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["types.go"],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/mesos/mesos-go/api/v1/lib/encoding",
|
||||
importpath = "github.com/mesos/mesos-go/api/v1/lib/encoding",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/codecs:all-srcs",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing:all-srcs",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/json:all-srcs",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/proto:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
28
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/codecs/BUILD
generated
vendored
Normal file
28
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/codecs/BUILD
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["codecs.go"],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/codecs",
|
||||
importpath = "github.com/mesos/mesos-go/api/v1/lib/encoding/codecs",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding:go_default_library",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/json:go_default_library",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
33
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/codecs/codecs.go
generated
vendored
Normal file
33
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/codecs/codecs.go
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
package codecs
|
||||
|
||||
import (
|
||||
"github.com/mesos/mesos-go/api/v1/lib/encoding"
|
||||
"github.com/mesos/mesos-go/api/v1/lib/encoding/json"
|
||||
"github.com/mesos/mesos-go/api/v1/lib/encoding/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// MediaTypeProtobuf is the Protobuf serialization format media type.
|
||||
MediaTypeProtobuf = encoding.MediaType("application/x-protobuf")
|
||||
// MediaTypeJSON is the JSON serialiation format media type.
|
||||
MediaTypeJSON = encoding.MediaType("application/json")
|
||||
|
||||
NameProtobuf = "protobuf"
|
||||
NameJSON = "json"
|
||||
)
|
||||
|
||||
// ByMediaType are pre-configured default Codecs, ready to use OOTB
|
||||
var ByMediaType = map[encoding.MediaType]encoding.Codec{
|
||||
MediaTypeProtobuf: encoding.Codec{
|
||||
Name: NameProtobuf,
|
||||
Type: MediaTypeProtobuf,
|
||||
NewEncoder: proto.NewEncoder,
|
||||
NewDecoder: proto.NewDecoder,
|
||||
},
|
||||
MediaTypeJSON: encoding.Codec{
|
||||
Name: NameJSON,
|
||||
Type: MediaTypeJSON,
|
||||
NewEncoder: json.NewEncoder,
|
||||
NewDecoder: json.NewDecoder,
|
||||
},
|
||||
}
|
26
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing/BUILD
generated
vendored
Normal file
26
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing/BUILD
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"decoder.go",
|
||||
"framing.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing",
|
||||
importpath = "github.com/mesos/mesos-go/api/v1/lib/encoding/framing",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
34
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing/decoder.go
generated
vendored
Normal file
34
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing/decoder.go
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
package framing
|
||||
|
||||
type (
|
||||
// UnmarshalFunc translates bytes to objects
|
||||
UnmarshalFunc func([]byte, interface{}) error
|
||||
|
||||
// Decoder reads and decodes Protobuf messages from an io.Reader.
|
||||
Decoder interface {
|
||||
// Decode reads the next encoded message from its input and stores it
|
||||
// in the value pointed to by m. If m isn't a proto.Message, Decode will panic.
|
||||
Decode(interface{}) error
|
||||
}
|
||||
|
||||
// DecoderFunc is the functional adaptation of Decoder
|
||||
DecoderFunc func(interface{}) error
|
||||
)
|
||||
|
||||
func (f DecoderFunc) Decode(m interface{}) error { return f(m) }
|
||||
|
||||
var _ = Decoder(DecoderFunc(nil))
|
||||
|
||||
// NewDecoder returns a new Decoder that reads from the given frame Reader.
|
||||
func NewDecoder(r Reader, uf UnmarshalFunc) DecoderFunc {
|
||||
return func(m interface{}) error {
|
||||
// Note: the buf returned by ReadFrame will change over time, it can't be sub-sliced
|
||||
// and then those sub-slices retained. Examination of generated proto code seems to indicate
|
||||
// that byte buffers are copied vs. referenced by sub-slice (gogo protoc).
|
||||
frame, err := r.ReadFrame()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return uf(frame, m)
|
||||
}
|
||||
}
|
70
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing/framing.go
generated
vendored
Normal file
70
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing/framing.go
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
package framing
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
type Error string
|
||||
|
||||
func (err Error) Error() string { return string(err) }
|
||||
|
||||
const (
|
||||
ErrorUnderrun = Error("frame underrun, unexpected EOF")
|
||||
ErrorBadSize = Error("bad frame size")
|
||||
ErrorOversizedFrame = Error("oversized frame, max size exceeded")
|
||||
)
|
||||
|
||||
type (
|
||||
// Reader generates data frames from some source, returning io.EOF when the end of the input stream is
|
||||
// detected.
|
||||
Reader interface {
|
||||
ReadFrame() (frame []byte, err error)
|
||||
}
|
||||
|
||||
// ReaderFunc is the functional adaptation of Reader.
|
||||
ReaderFunc func() ([]byte, error)
|
||||
|
||||
// Writer sends whole frames to some endpoint; returns io.ErrShortWrite if the frame is only partially written.
|
||||
Writer interface {
|
||||
WriteFrame(frame []byte) error
|
||||
}
|
||||
|
||||
// WriterFunc is the functional adaptation of Writer.
|
||||
WriterFunc func([]byte) error
|
||||
)
|
||||
|
||||
func (f ReaderFunc) ReadFrame() ([]byte, error) { return f() }
|
||||
func (f WriterFunc) WriteFrame(b []byte) error { return f(b) }
|
||||
|
||||
var _ = Reader(ReaderFunc(nil))
|
||||
var _ = Writer(WriterFunc(nil))
|
||||
|
||||
// EOFReaderFunc always returns nil, io.EOF; it implements the ReaderFunc API.
|
||||
func EOFReaderFunc() ([]byte, error) { return nil, io.EOF }
|
||||
|
||||
var _ = ReaderFunc(EOFReaderFunc) // sanity check
|
||||
|
||||
// ReadAll returns a reader func that returns the complete contents of `r` in a single frame.
|
||||
// A zero length frame is treated as an "end of stream" condition, returning io.EOF.
|
||||
func ReadAll(r io.Reader) ReaderFunc {
|
||||
return func() (b []byte, err error) {
|
||||
b, err = ioutil.ReadAll(r)
|
||||
if len(b) == 0 && err == nil {
|
||||
err = io.EOF
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// WriterFor adapts an io.Writer to the Writer interface. All buffers are written to `w` without decoration or
|
||||
// modification.
|
||||
func WriterFor(w io.Writer) WriterFunc {
|
||||
return func(b []byte) error {
|
||||
n, err := w.Write(b)
|
||||
if err == nil && n != len(b) {
|
||||
return io.ErrShortWrite
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
27
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/json/BUILD
generated
vendored
Normal file
27
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/json/BUILD
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["json.go"],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/json",
|
||||
importpath = "github.com/mesos/mesos-go/api/v1/lib/encoding/json",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding:go_default_library",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
28
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/json/json.go
generated
vendored
Normal file
28
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/json/json.go
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
package json
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/mesos/mesos-go/api/v1/lib/encoding"
|
||||
"github.com/mesos/mesos-go/api/v1/lib/encoding/framing"
|
||||
)
|
||||
|
||||
// NewEncoder returns a new Encoder of Calls to JSON messages written to
|
||||
// the given io.Writer.
|
||||
func NewEncoder(s encoding.Sink) encoding.Encoder {
|
||||
w := s()
|
||||
return encoding.EncoderFunc(func(m encoding.Marshaler) error {
|
||||
b, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return w.WriteFrame(b)
|
||||
})
|
||||
}
|
||||
|
||||
// NewDecoder returns a new Decoder of JSON messages read from the given source.
|
||||
func NewDecoder(s encoding.Source) encoding.Decoder {
|
||||
r := s()
|
||||
dec := framing.NewDecoder(r, json.Unmarshal)
|
||||
return encoding.DecoderFunc(func(u encoding.Unmarshaler) error { return dec.Decode(u) })
|
||||
}
|
31
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/proto/BUILD
generated
vendored
Normal file
31
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/proto/BUILD
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"encoding.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/proto",
|
||||
importpath = "github.com/mesos/mesos-go/api/v1/lib/encoding/proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding:go_default_library",
|
||||
"//vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/framing:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
4
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/proto/doc.go
generated
vendored
Normal file
4
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/proto/doc.go
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
// Package proto implements protobuf utilities such as functional options to
|
||||
// construct complex structs and encoders and decoders composable with
|
||||
// io.ReadWriters.
|
||||
package proto
|
30
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/proto/encoding.go
generated
vendored
Normal file
30
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/proto/encoding.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/mesos/mesos-go/api/v1/lib/encoding"
|
||||
"github.com/mesos/mesos-go/api/v1/lib/encoding/framing"
|
||||
)
|
||||
|
||||
// NewEncoder returns a new Encoder of Calls to Protobuf messages written to
|
||||
// the given io.Writer.
|
||||
func NewEncoder(s encoding.Sink) encoding.Encoder {
|
||||
w := s()
|
||||
return encoding.EncoderFunc(func(m encoding.Marshaler) error {
|
||||
b, err := proto.Marshal(m.(proto.Message))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return w.WriteFrame(b)
|
||||
})
|
||||
}
|
||||
|
||||
// NewDecoder returns a new Decoder of Protobuf messages read from the given Source.
|
||||
func NewDecoder(s encoding.Source) encoding.Decoder {
|
||||
r := s()
|
||||
var (
|
||||
uf = func(b []byte, m interface{}) error { return proto.Unmarshal(b, m.(proto.Message)) }
|
||||
dec = framing.NewDecoder(r, uf)
|
||||
)
|
||||
return encoding.DecoderFunc(func(u encoding.Unmarshaler) error { return dec.Decode(u) })
|
||||
}
|
111
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/types.go
generated
vendored
Normal file
111
vendor/github.com/mesos/mesos-go/api/v1/lib/encoding/types.go
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
package encoding
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
|
||||
pb "github.com/gogo/protobuf/proto"
|
||||
"github.com/mesos/mesos-go/api/v1/lib/encoding/framing"
|
||||
)
|
||||
|
||||
type MediaType string
|
||||
|
||||
// ContentType returns the HTTP Content-Type associated with the MediaType
|
||||
func (m MediaType) ContentType() string { return string(m) }
|
||||
|
||||
type (
|
||||
Source func() framing.Reader
|
||||
Sink func() framing.Writer
|
||||
|
||||
// A Codec composes encoding and decoding of a serialization format.
|
||||
Codec struct {
|
||||
Name string
|
||||
Type MediaType
|
||||
NewEncoder func(Sink) Encoder
|
||||
NewDecoder func(Source) Decoder
|
||||
}
|
||||
|
||||
SourceFactory interface {
|
||||
NewSource(r io.Reader) Source
|
||||
}
|
||||
SourceFactoryFunc func(r io.Reader) Source
|
||||
|
||||
SinkFactory interface {
|
||||
NewSink(w io.Writer) Sink
|
||||
}
|
||||
SinkFactoryFunc func(w io.Writer) Sink
|
||||
)
|
||||
|
||||
func (f SourceFactoryFunc) NewSource(r io.Reader) Source { return f(r) }
|
||||
|
||||
func (f SinkFactoryFunc) NewSink(w io.Writer) Sink { return f(w) }
|
||||
|
||||
var (
|
||||
_ = SourceFactory(SourceFactoryFunc(nil))
|
||||
_ = SinkFactory(SinkFactoryFunc(nil))
|
||||
)
|
||||
|
||||
// SourceReader returns a Source that buffers all input from the given io.Reader
|
||||
// and returns the contents in a single frame.
|
||||
func SourceReader(r io.Reader) Source {
|
||||
ch := make(chan framing.ReaderFunc, 1)
|
||||
ch <- framing.ReadAll(r)
|
||||
return func() framing.Reader {
|
||||
select {
|
||||
case f := <-ch:
|
||||
return f
|
||||
default:
|
||||
return framing.ReaderFunc(framing.EOFReaderFunc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SinkWriter returns a Sink that sends a frame to an io.Writer with no decoration.
|
||||
func SinkWriter(w io.Writer) Sink { return func() framing.Writer { return framing.WriterFor(w) } }
|
||||
|
||||
// String implements the fmt.Stringer interface.
|
||||
func (c *Codec) String() string {
|
||||
if c == nil {
|
||||
return ""
|
||||
}
|
||||
return c.Name
|
||||
}
|
||||
|
||||
type (
|
||||
// Marshaler composes the supported marshaling formats.
|
||||
Marshaler interface {
|
||||
pb.Marshaler
|
||||
json.Marshaler
|
||||
}
|
||||
// Unmarshaler composes the supporter unmarshaling formats.
|
||||
Unmarshaler interface {
|
||||
pb.Unmarshaler
|
||||
json.Unmarshaler
|
||||
}
|
||||
// An Encoder encodes a given Marshaler or returns an error in case of failure.
|
||||
Encoder interface {
|
||||
Encode(Marshaler) error
|
||||
}
|
||||
|
||||
// EncoderFunc is the functional adapter for Encoder
|
||||
EncoderFunc func(Marshaler) error
|
||||
|
||||
// A Decoder decodes a given Unmarshaler or returns an error in case of failure.
|
||||
Decoder interface {
|
||||
Decode(Unmarshaler) error
|
||||
}
|
||||
|
||||
// DecoderFunc is the functional adapter for Decoder
|
||||
DecoderFunc func(Unmarshaler) error
|
||||
)
|
||||
|
||||
// Decode implements the Decoder interface
|
||||
func (f DecoderFunc) Decode(u Unmarshaler) error { return f(u) }
|
||||
|
||||
// Encode implements the Encoder interface
|
||||
func (f EncoderFunc) Encode(m Marshaler) error { return f(m) }
|
||||
|
||||
var (
|
||||
_ = Encoder(EncoderFunc(nil))
|
||||
_ = Decoder(DecoderFunc(nil))
|
||||
)
|
Reference in New Issue
Block a user