var protoEncodingPrefix … type errNotMarshalable … func (e errNotMarshalable) Error() string { … } func (e errNotMarshalable) Status() metav1.Status { … } // IsNotMarshalable checks the type of error, returns a boolean true if error is not nil and not marshalable false otherwise func IsNotMarshalable(err error) bool { … } // 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 NewSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper) *Serializer { … } type Serializer … var _ … var _ … var _ … const serializerIdentifier … // 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 (s *Serializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) { … } // EncodeWithAllocator writes an object to the provided writer. // In addition, it allows for providing a memory allocator for efficient memory usage during object serialization. func (s *Serializer) EncodeWithAllocator(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error { … } // Encode serializes the provided object to the given writer. func (s *Serializer) Encode(obj runtime.Object, w io.Writer) error { … } func (s *Serializer) encode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error { … } func (s *Serializer) doEncode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error { … } // Identifier implements runtime.Encoder interface. func (s *Serializer) Identifier() runtime.Identifier { … } // RecognizesData implements the RecognizingDecoder interface. func (s *Serializer) RecognizesData(data []byte) (bool, bool, error) { … } // copyKindDefaults defaults dst to the value in src if dst does not have a value set. func copyKindDefaults(dst, src *schema.GroupVersionKind) { … } type bufferedMarshaller … type bufferedReverseMarshaller … // estimateUnknownSize returns the expected bytes consumed by a given runtime.Unknown // object with a nil RawJSON struct and the expected size of the provided buffer. The // returned size will not be correct if RawJSOn is set on unk. func estimateUnknownSize(unk *runtime.Unknown, byteSize uint64) uint64 { … } // 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 NewRawSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper) *RawSerializer { … } type RawSerializer … var _ … const rawSerializerIdentifier … // 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 (s *RawSerializer) Decode(originalData []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) { … } // unmarshalToObject is the common code between decode in the raw and normal serializer. func unmarshalToObject(typer runtime.ObjectTyper, creater runtime.ObjectCreater, actual *schema.GroupVersionKind, into runtime.Object, data []byte) (runtime.Object, *schema.GroupVersionKind, error) { … } // Encode serializes the provided object to the given writer. Overrides is ignored. func (s *RawSerializer) Encode(obj runtime.Object, w io.Writer) error { … } // EncodeWithAllocator writes an object to the provided writer. // In addition, it allows for providing a memory allocator for efficient memory usage during object serialization. func (s *RawSerializer) EncodeWithAllocator(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error { … } func (s *RawSerializer) encode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error { … } func (s *RawSerializer) doEncode(obj runtime.Object, w io.Writer, memAlloc runtime.MemoryAllocator) error { … } // Identifier implements runtime.Encoder interface. func (s *RawSerializer) Identifier() runtime.Identifier { … } var LengthDelimitedFramer … type lengthDelimitedFramer … // NewFrameWriter implements stream framing for this serializer func (lengthDelimitedFramer) NewFrameWriter(w io.Writer) io.Writer { … } // NewFrameReader implements stream framing for this serializer func (lengthDelimitedFramer) NewFrameReader(r io.ReadCloser) io.ReadCloser { … }