package arg2

import "github.com/uber/tchannel-go/thrift/arg2"

Package arg2 contains tchannel thrift Arg2 interfaces for external use.

These interfaces are currently unstable, and aren't covered by the API backwards-compatibility guarantee.

Index

Types

type KeyValIterator

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

KeyValIterator is a iterator for reading tchannel-thrift Arg2 Scheme, which has key/value pairs (k~2 v~2). NOTE: to be optimized for performance, we try to limit the allocation done in the process of iteration.

func NewKeyValIterator

func NewKeyValIterator(arg2Payload []byte) (KeyValIterator, error)

NewKeyValIterator inits a KeyValIterator with the buffer pointing at start of Arg2. Return io.EOF if no iterator is available. NOTE: tchannel-thrift Arg Scheme starts with number of key/value pair.

func (KeyValIterator) Key

func (i KeyValIterator) Key() []byte

Key Returns the key.

func (KeyValIterator) Next

func (i KeyValIterator) Next() (kv KeyValIterator, _ error)

Next returns next iterator. Return io.EOF if no more key/value pair is available.

Note: We used named returns because of an unexpected performance improvement See https://github.com/golang/go/issues/40638

func (KeyValIterator) Remaining

func (i KeyValIterator) Remaining() bool

Remaining returns whether there's any pairs left to consume.

func (KeyValIterator) Value

func (i KeyValIterator) Value() []byte

Value returns value.

Source Files

kv_iterator.go

Version
v1.34.6 (latest)
Published
Jan 8, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
1 day ago

Tools for package owners.