apache

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package apache contains code for working with apache thrift indirectly

It acts as a bridge between generated code which relies on apache codec like:

Write(p thrift.TProtocol) error
Read(p thrift.TProtocol) error

and kitex ecosystem.

Because we're deprecating apache thrift, all kitex ecosystem code will not rely on apache thrift except one pkg: `github.com/cloudwego/kitex/pkg/protocol/bthrift`. Why is the package chosen? All legacy generated code relies on it, and we may not be able to update the code in a brief timeframe. So the package is chosen to register helper methods to this package in order to use it without importing `github.com/apache/thrift`

Users must call `RegisterCheckTStruct`, `RegisterThriftRead` and `RegisterThriftWrite` for using `CheckTStruct`, `ThriftRead`, and `ThriftWrite`

see README.md of `bthrift` above for more details

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTStruct added in v0.1.1

func CheckTStruct(v interface{}) error

CheckTStruct ...

func RegisterCheckTStruct added in v0.1.1

func RegisterCheckTStruct(fn func(v interface{}) error)

RegisterCheckTStruct accepts `thrift.TStruct check` func and save it for later use.

func RegisterThriftRead added in v0.1.1

func RegisterThriftRead(fn func(r bufiox.Reader, v interface{}) error)

RegisterThriftRead ...

func RegisterThriftWrite added in v0.1.1

func RegisterThriftWrite(fn func(w bufiox.Writer, v interface{}) error)

RegisterThriftWrite ...

func ThriftRead

func ThriftRead(r bufiox.Reader, v interface{}) error

ThriftRead ...

func ThriftWrite

func ThriftWrite(w bufiox.Writer, v interface{}) error

ThriftWrite ...

Types

type TTransport

type TTransport interface {
	io.ReadWriteCloser
	RemainingBytes() (num_bytes uint64)
	Flush(ctx context.Context) (err error)
	Open() error
	IsOpen() bool
}

TTransport is identical with thrift.TTransport.

func NewBufferTransport added in v0.1.1

func NewBufferTransport(buf *bytes.Buffer) TTransport

NewBufferTransport extends bytes.Buffer to support TTransport

func NewDefaultTransport added in v0.1.1

func NewDefaultTransport(rw io.ReadWriter) TTransport

NewDefaultTransport converts io.ReadWriter to TTransport. Use NewBufferTransport if using *bytes.Buffer for better performance.

Jump to

Keyboard shortcuts

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