Documentation ¶
Overview ¶
Package protobuf provides a Kubernetes serializer for the protobuf format.
Index ¶
- Variables
- func IsNotMarshalable(err error) bool
- type RawSerializer
- type Serializer
- func (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error)
- func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error
- func (s *Serializer) Identifier() runtime.Identifier
- func (s *Serializer) RecognizesData(data []byte) (bool, bool, error)
Constants ¶
This section is empty.
Variables ¶
var LengthDelimitedFramer = lengthDelimitedFramer{}
LengthDelimitedFramer is exported variable of type lengthDelimitedFramer
Functions ¶
func IsNotMarshalable ¶
IsNotMarshalable checks the type of error, returns a boolean true if error is not nil and not marshalable false otherwise
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.
func (*RawSerializer) Encode ¶
Encode serializes the provided object to the given writer. Overrides is ignored.
func (*RawSerializer) Identifier ¶
func (s *RawSerializer) Identifier() runtime.Identifier
Identifier implements runtime.Encoder interface.
type Serializer ¶
type Serializer struct {
// contains filtered or unexported fields
}
Serializer handles encoding versioned objects into the proper wire form
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) Identifier ¶
func (s *Serializer) Identifier() runtime.Identifier
Identifier implements runtime.Encoder interface.
func (*Serializer) RecognizesData ¶
func (s *Serializer) RecognizesData(data []byte) (bool, bool, error)
RecognizesData implements the RecognizingDecoder interface.