protobuf

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2016 License: Apache-2.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package protobuf provides a Kubernetes serializer for the protobuf format.

Index

Constants

This section is empty.

Variables

View Source
var LengthDelimitedFramer = lengthDelimitedFramer{}

Functions

func IsNotMarshalable

func IsNotMarshalable(err error) bool

Types

type RawSerializer

type RawSerializer struct {
	// contains filtered or unexported fields
}

RawSerializer encodes and decodes objects without adding a runtime.Unknown wrapper (objects are encoded without identifying type).

func NewRawSerializer

func NewRawSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper, defaultContentType string) *RawSerializer

NewRawSerializer creates a Protobuf serializer that handles encoding versioned objects into the proper wire form. If typer is not nil, the object has the group, version, and kind fields set. This serializer does not provide type information for the encoded object, and thus is not self describing (callers must know what type is being described in order to decode).

This encoding scheme is experimental, and is subject to change at any time.

func (*RawSerializer) Decode

Decode attempts to convert the provided data into a protobuf message, extract the stored schema kind, apply the provided default gvk, and then load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown, the raw data will be extracted and no decoding will be performed. If into is not registered with the typer, then the object will be straight decoded using normal protobuf unmarshalling (the MarshalTo interface). If into is provided and the original data is not fully qualified with kind/version/group, the type of the into will be used to alter the returned gvk. On success or most errors, the method will return the calculated schema kind.

func (*RawSerializer) Encode

func (s *RawSerializer) Encode(obj runtime.Object, w io.Writer) error

Encode serializes the provided object to the given writer. Overrides is ignored.

type Serializer

type Serializer struct {
	// contains filtered or unexported fields
}

func NewSerializer

func NewSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper, defaultContentType string) *Serializer

NewSerializer creates a Protobuf serializer that handles encoding versioned objects into the proper wire form. If a typer is passed, the encoded object will have group, version, and kind fields set. If typer is nil, the objects will be written as-is (any type info passed with the object will be used).

This encoding scheme is experimental, and is subject to change at any time.

func (*Serializer) Decode

Decode attempts to convert the provided data into a protobuf message, extract the stored schema kind, apply the provided default gvk, and then load that data into an object matching the desired schema kind or the provided into. If into is *runtime.Unknown, the raw data will be extracted and no decoding will be performed. If into is not registered with the typer, then the object will be straight decoded using normal protobuf unmarshalling (the MarshalTo interface). If into is provided and the original data is not fully qualified with kind/version/group, the type of the into will be used to alter the returned gvk. On success or most errors, the method will return the calculated schema kind.

func (*Serializer) Encode

func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error

Encode serializes the provided object to the given writer.

func (*Serializer) RecognizesData

func (s *Serializer) RecognizesData(peek io.Reader) (bool, bool, error)

RecognizesData implements the RecognizingDecoder interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL