type metaFactory … type defaultMetaFactory … func (mf *defaultMetaFactory) Interpret(data []byte) (*schema.GroupVersionKind, error) { … } type Serializer … var _ … type options … type Option … // Strict configures a serializer to return a strict decoding error when it encounters map keys that // do not correspond to a field in the target object of a decode operation. This option is disabled // by default. func Strict(s bool) Option { … } // Transcode configures a serializer to transcode the "raw" bytes of a decoded runtime.RawExtension // or metav1.FieldsV1 object to JSON. This is enabled by default to support existing programs that // depend on the assumption that objects of either type contain valid JSON. func Transcode(s bool) Option { … } type serializer … func (serializer) private() { … } // NewSerializer creates and returns a serializer configured with the provided options. The default // options are equivalent to explicitly passing Strict(false) and Transcode(true). func NewSerializer(creater runtime.ObjectCreater, typer runtime.ObjectTyper, options ...Option) Serializer { … } func newSerializer(metaFactory metaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper, options ...Option) *serializer { … } func (s *serializer) Identifier() runtime.Identifier { … } // Encode writes a CBOR representation of the given object. // // Because the CBOR data item written by a call to Encode is always enclosed in the "self-described // CBOR" tag, its encoded form always has the prefix 0xd9d9f7. This prefix is suitable for use as a // "magic number" for distinguishing encoded CBOR from other protocols. // // The default serialization behavior for any given object replicates the behavior of the JSON // serializer as far as it is necessary to allow the CBOR serializer to be used as a drop-in // replacement for the JSON serializer, with limited exceptions. For example, the distinction // between integers and floating-point numbers is preserved in CBOR due to its distinct // representations for each type. // // Objects implementing runtime.Unstructured will have their unstructured content encoded rather // than following the default behavior for their dynamic type. func (s *serializer) Encode(obj runtime.Object, w io.Writer) error { … } func (s *serializer) EncodeNondeterministic(obj runtime.Object, w io.Writer) error { … } func (s *serializer) encode(mode modes.EncMode, obj runtime.Object, w io.Writer) error { … } // gvkWithDefaults returns group kind and version defaulting from provided default func gvkWithDefaults(actual, defaultGVK schema.GroupVersionKind) schema.GroupVersionKind { … } // diagnose returns the diagnostic encoding of a well-formed CBOR data item. func diagnose(data []byte) string { … } // unmarshal unmarshals CBOR data from the provided byte slice into a Go object. If the decoder is // configured to report strict errors, the first error return value may be a non-nil strict decoding // error. If the last error return value is non-nil, then the unmarshal failed entirely and the // state of the destination object should not be relied on. func (s *serializer) unmarshal(data []byte, into interface{ … } func (s *serializer) Decode(data []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) { … } var selfDescribedCBOR … func (s *serializer) RecognizesData(data []byte) (ok, unknown bool, err error) { … }