Documentation ¶
Overview ¶
Package protobuf provides a Kubernetes serializer for the protobuf format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LengthDelimitedFramer = lengthDelimitedFramer{}
Functions ¶
func IsNotMarshalable ¶
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) *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 ¶
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.
type Serializer ¶
type Serializer struct {
// contains filtered or unexported fields
}
func NewSerializer ¶
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 ¶
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) RecognizesData ¶
RecognizesData implements the RecognizingDecoder interface.