serializer

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NegotiatedSerializerWrapper added in v1.3.0

func NegotiatedSerializerWrapper(info runtime.SerializerInfo, streamInfo runtime.StreamSerializerInfo) runtime.NegotiatedSerializer

Types

type CodecFactory

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

CodecFactory provides methods for retrieving codecs and serializers for specific versions and content types.

func NewCodecFactory

func NewCodecFactory(scheme *runtime.Scheme) CodecFactory

NewCodecFactory provides methods for retrieving serializers for the supported wire formats and conversion wrappers to define preferred internal and external versions. In the future, as the internal version is used less, callers may instead use a defaulting serializer and only convert objects which are shared internally (Status, common API machinery). TODO: allow other codecs to be compiled in? TODO: accept a scheme interface

func (CodecFactory) CodecForVersions

func (f CodecFactory) CodecForVersions(encoder runtime.Encoder, decoder runtime.Decoder, encode []unversioned.GroupVersion, decode []unversioned.GroupVersion) runtime.Codec

CodecFor creates a codec with the provided serializer. If an object is decoded and its group is not in the list, it will default to runtime.APIVersionInternal. If encode is not specified for an object's group, the object is not converted. If encode or decode are nil, no conversion is performed.

func (CodecFactory) DecoderToVersion

func (f CodecFactory) DecoderToVersion(decoder runtime.Decoder, gv unversioned.GroupVersion) runtime.Decoder

DecoderToVersion returns a decoder that targets the provided group version.

func (CodecFactory) EncoderForVersion

func (f CodecFactory) EncoderForVersion(encoder runtime.Encoder, gv unversioned.GroupVersion) runtime.Encoder

EncoderForVersion returns an encoder that targets the provided group version.

func (CodecFactory) LegacyCodec

func (f CodecFactory) LegacyCodec(version ...unversioned.GroupVersion) runtime.Codec

LegacyCodec encodes output to a given API version, and decodes output into the internal form from any recognized source. The returned codec will always encode output to JSON.

This method is deprecated - clients and servers should negotiate a serializer by mime-type and invoke CodecForVersions. Callers that need only to read data should use UniversalDecoder().

func (CodecFactory) SerializerForFileExtension

func (f CodecFactory) SerializerForFileExtension(extension string) (runtime.Serializer, bool)

SerializerForFileExtension returns a serializer for the provided extension, or false if no serializer matches.

func (CodecFactory) SerializerForMediaType

func (f CodecFactory) SerializerForMediaType(mediaType string, params map[string]string) (runtime.SerializerInfo, bool)

SerializerForMediaType returns a serializer that matches the provided RFC2046 mediaType, or false if no such serializer exists

func (CodecFactory) StreamingSerializerForMediaType added in v1.3.0

func (f CodecFactory) StreamingSerializerForMediaType(mediaType string, params map[string]string) (runtime.StreamSerializerInfo, bool)

StreamingSerializerForMediaType returns a serializer that matches the provided RFC2046 mediaType, or false if no such serializer exists

func (CodecFactory) SupportedMediaTypes

func (f CodecFactory) SupportedMediaTypes() []string

SupportedMediaTypes returns the RFC2046 media types that this factory has serializers for.

func (CodecFactory) SupportedStreamingMediaTypes added in v1.3.0

func (f CodecFactory) SupportedStreamingMediaTypes() []string

SupportedStreamingMediaTypes returns the RFC2046 media types that this factory has stream serializers for.

func (CodecFactory) UniversalDecoder

func (f CodecFactory) UniversalDecoder(versions ...unversioned.GroupVersion) runtime.Decoder

UniversalDecoder returns a runtime.Decoder capable of decoding all known API objects in all known formats. Used by clients that do not need to encode objects but want to deserialize API objects stored on disk. Only decodes objects in groups registered with the scheme. The GroupVersions passed may be used to select alternate versions of objects to return - by default, runtime.APIVersionInternal is used. If any versions are specified, unrecognized groups will be returned in the version they are encoded as (no conversion). This decoder performs defaulting.

TODO: the decoder will eventually be removed in favor of dealing with objects in their versioned form

func (CodecFactory) UniversalDeserializer

func (f CodecFactory) UniversalDeserializer() runtime.Decoder

UniversalDeserializer can convert any stored data recognized by this factory into a Go object that satisfies runtime.Object. It does not perform conversion. It does not perform defaulting.

type DirectCodec added in v1.3.0

type DirectCodec struct {
	runtime.Serializer
	runtime.ObjectTyper
}

DirectCodec is a codec that does not do conversion. It sets the gvk during serialization, and removes the gvk during deserialization.

func (DirectCodec) Decode added in v1.3.0

Decode does not do conversion. It removes the gvk during deserialization.

func (DirectCodec) Encode added in v1.3.0

func (c DirectCodec) Encode(obj runtime.Object, stream io.Writer) error

EncodeToStream does not do conversion. It sets the gvk during serialization. overrides are ignored.

type DirectCodecFactory added in v1.3.0

type DirectCodecFactory struct {
	CodecFactory
}

DirectCodecFactory provides methods for retrieving "DirectCodec"s, which do not do conversion.

func (DirectCodecFactory) DecoderToVersion added in v1.3.0

func (f DirectCodecFactory) DecoderToVersion(serializer runtime.Decoder, gv unversioned.GroupVersion) runtime.Decoder

DecoderToVersion returns an decoder that does not do conversion. gv is ignored.

func (DirectCodecFactory) EncoderForVersion added in v1.3.0

func (f DirectCodecFactory) EncoderForVersion(serializer runtime.Encoder, gv unversioned.GroupVersion) runtime.Encoder

EncoderForVersion returns an encoder that does not do conversion. gv is ignored.

Directories

Path Synopsis
Package protobuf provides a Kubernetes serializer for the protobuf format.
Package protobuf provides a Kubernetes serializer for the protobuf format.
Package streaming implements encoder and decoder for streams of runtime.Objects over io.Writer/Readers.
Package streaming implements encoder and decoder for streams of runtime.Objects over io.Writer/Readers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL