package thrift

import "github.com/apache/arrow/go/v10/parquet/internal/thrift"

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

Index

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

Source Files

helpers.go

Version
v10.0.1 (latest)
Published
Nov 15, 2022
Platform
linux/amd64
Imports
5 packages
Last checked
13 hours ago

Tools for package owners.