Documentation
¶
Index ¶
Constants ¶
const ( // ProtobufMediaType is the Protobuf serialization format media type. ProtobufMediaType = "application/x-protobuf" // JSONMediaType is the JSON serialiation format media type. JSONMediaType = "application/json" )
Variables ¶
var ( // ProtobufCodec is the Mesos scheduler API Protobufs codec. ProtobufCodec = Codec{ Name: "protobuf", MediaTypes: [2]string{ProtobufMediaType, ProtobufMediaType}, NewEncoder: NewProtobufEncoder, NewDecoder: NewProtobufDecoder, } // JSONCodec is the Mesos scheduler API JSON codec. JSONCodec = Codec{ Name: "json", MediaTypes: [2]string{JSONMediaType, JSONMediaType}, NewEncoder: NewJSONEncoder, NewDecoder: NewJSONDecoder, } )
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct { // Name holds the codec name. Name string // MediaTypes holds the media types of the codec encoding and decoding // formats, respectively. MediaTypes [2]string // NewEncoder returns a new encoder for the defined media type. NewEncoder func(io.Writer) Encoder // NewDecoder returns a new decoder for the defined media type. NewDecoder func(framing.Reader) Decoder }
A Codec composes encoding and decoding of a serialization format.
type Decoder ¶
type Decoder interface {
Decode(Unmarshaler) error
}
A Decoder decodes a given Unmarshaler or returns an error in case of failure.
func NewJSONDecoder ¶
NewJSONDecoder returns a new Decoder of JSON messages read from the given io.Reader to Events.
func NewProtobufDecoder ¶
NewProtobufDecoder returns a new Decoder of Protobuf messages read from the given io.Reader to Events.
type DecoderFunc ¶
type DecoderFunc func(Unmarshaler) error
DecoderFunc is the functional adapter for Decoder
func (DecoderFunc) Decode ¶
func (f DecoderFunc) Decode(u Unmarshaler) error
Decode implements the Decoder interface
type Encoder ¶
An Encoder encodes a given Marshaler or returns an error in case of failure.
func NewJSONEncoder ¶
NewJSONEncoder returns a new Encoder of Calls to JSON messages written to the given io.Writer.
func NewProtobufEncoder ¶
NewProtobufEncoder returns a new Encoder of Calls to Protobuf messages written to the given io.Writer.
type EncoderFunc ¶
EncoderFunc is the functional adapter for Encoder
func (EncoderFunc) Encode ¶
func (f EncoderFunc) Encode(m Marshaler) error
Encode implements the Encoder interface
type Unmarshaler ¶
type Unmarshaler interface { pb.Unmarshaler json.Unmarshaler }
Unmarshaler composes the supporter unmarshaling formats.
Directories
¶
Path | Synopsis |
---|---|
Package proto implements protobuf utilities such as functional options to construct complex structs and encoders and decoders composable with io.ReadWriters.
|
Package proto implements protobuf utilities such as functional options to construct complex structs and encoders and decoders composable with io.ReadWriters. |