thrift

package
v11.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 5 Imported by: 0

Documentation

Overview

Package thrift is just some useful helpers for interacting with thrift to make other code easier to read/write and centralize interactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeserializeThrift

func DeserializeThrift(msg thrift.TStruct, buf []byte) (remain uint64, err error)

DeserializeThrift deserializes the bytes in buf into the given thrift msg type returns the number of remaining bytes in the buffer that weren't needed for deserialization and any error if there was one, or nil.

func DeserializeThriftStream

func DeserializeThriftStream(msg thrift.TStruct, r io.Reader) error

DeserializeThriftStream populates the given msg by reading from the provided stream until it completes the deserialization.

func SerializeThriftStream

func SerializeThriftStream(msg thrift.TStruct, w io.Writer) error

SerializeThriftStream writes out the serialized bytes of the passed in type to the given writer stream.

Types

type Serializer

type Serializer struct {
	thrift.TSerializer
}

Serializer is an object that can stick around to provide convenience functions and allow object reuse

func NewThriftSerializer

func NewThriftSerializer() *Serializer

NewThriftSerializer constructs a serializer with a default buffer of 1024

func (*Serializer) Serialize

func (t *Serializer) Serialize(msg thrift.TStruct, w io.Writer, enc encryption.Encryptor) (int, error)

Serialize will serialize the given msg to the writer stream w, optionally encrypting it on the way if enc is not nil, returning the total number of bytes written and any error received, or nil

Jump to

Keyboard shortcuts

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