Documentation ¶
Index ¶
- Constants
- Variables
- func EnvelopeMetadataFromPayload(unencodedPayload []byte) (EnvelopeFormat, Version)
- func IsEnveloped(data []byte) bool
- func MarshalEnvelope(format EnvelopeFormat, model Versioner) ([]byte, error)
- func MarshalJSON(v Versioner) ([]byte, error)
- func MarshalProto(v ProtoVersioner) ([]byte, error)
- func UnmarshalEnvelope(logger lager.Logger, unencodedPayload []byte, model Versioner) error
- func UnmarshalJSON(logger lager.Logger, marshaledPayload []byte, model Versioner) error
- func UnmarshalProto(logger lager.Logger, marshaledPayload []byte, model ProtoVersioner) error
- type Encoder
- type Encoding
- type EnvelopeFormat
- type Format
- type ProtoVersioner
- type Serializer
- type Version
- type Versioner
Constants ¶
View Source
const EncodingOffset int = 2
View Source
const EnvelopeOffset int = 2
Variables ¶
View Source
var ValidVersions = []Version{V0, V1}
Functions ¶
func EnvelopeMetadataFromPayload ¶
func EnvelopeMetadataFromPayload(unencodedPayload []byte) (EnvelopeFormat, Version)
func IsEnveloped ¶
func MarshalEnvelope ¶
func MarshalEnvelope(format EnvelopeFormat, model Versioner) ([]byte, error)
func MarshalJSON ¶
func MarshalProto ¶
func MarshalProto(v ProtoVersioner) ([]byte, error)
func UnmarshalEnvelope ¶
func UnmarshalJSON ¶
func UnmarshalProto ¶
func UnmarshalProto(logger lager.Logger, marshaledPayload []byte, model ProtoVersioner) error
Types ¶
type Encoder ¶
type Encoder interface { Encode(encoding Encoding, payload []byte) ([]byte, error) Decode(payload []byte) ([]byte, error) }
func NewEncoder ¶
func NewEncoder(cryptor encryption.Cryptor) Encoder
type Encoding ¶
type Encoding [EncodingOffset]byte
type EnvelopeFormat ¶
type EnvelopeFormat byte
const ( LEGACY_JSON EnvelopeFormat = 0 JSON EnvelopeFormat = 1 PROTO EnvelopeFormat = 2 )
type Format ¶
type Format struct { Encoding EnvelopeFormat }
func NewFormat ¶
func NewFormat(encoding Encoding, format EnvelopeFormat) *Format
type ProtoVersioner ¶
type Serializer ¶
type Serializer interface { Marshal(logger lager.Logger, format *Format, model Versioner) ([]byte, error) Unmarshal(logger lager.Logger, encodedPayload []byte, model Versioner) error }
func NewSerializer ¶
func NewSerializer(cryptor encryption.Cryptor) Serializer
Click to show internal directories.
Click to hide internal directories.