apimachinery: k8s.io/apimachinery/pkg/runtime/serializer/protobuf Index | Files

package protobuf

import "k8s.io/apimachinery/pkg/runtime/serializer/protobuf"

Package protobuf provides a Kubernetes serializer for the protobuf format.

Index

Package Files

doc.go protobuf.go

Variables

var LengthDelimitedFramer = lengthDelimitedFramer{}

func IsNotMarshalable Uses

func IsNotMarshalable(err error) bool

type RawSerializer Uses

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 Uses

func NewRawSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper) *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 Uses

func (s *RawSerializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error)

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 Uses

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 Uses

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

func NewSerializer Uses

func NewSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper) *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).

func (*Serializer) Decode Uses

func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error)

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 Uses

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

Encode serializes the provided object to the given writer.

func (*Serializer) RecognizesData Uses

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

RecognizesData implements the RecognizingDecoder interface.

Package protobuf imports 11 packages (graph) and is imported by 7 packages. Updated 2019-07-26. Refresh now. Tools for package owners.