streamcall

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 42

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCallOptions

func GetCallOptions(ops []Option) []callopt.Option

GetCallOptions converts given streamcall.Option(s) to callopt.Option

Types

type Option

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

Option is the option type used in StreamClient's Call method

func ConvertOptionFrom deprecated

func ConvertOptionFrom(option callopt.Option) Option

Deprecated: it's not supposed to be called by users directly; may be removed in future versions. ConvertOptionFrom converts a callopt.Option to StreamOption It's convenient for creating StreamOption from existing callopt.Option Note: NOT all callopt.Option(s) converted will work for stream clients; Even if it works for now, it's NOT guaranteed that it will always work for future versions.

func WithConnectTimeout

func WithConnectTimeout(d time.Duration) Option

WithConnectTimeout specifies the connection timeout for a RPC call.

func WithGRPCCompressor

func WithGRPCCompressor(compressorName string) Option

WithGRPCCompressor specifies the compressor for the GRPC frame payload.

func WithHostPort

func WithHostPort(hostPort string) Option

WithHostPort specifies the target address for an RPC call.

func WithRecvTimeout deprecated added in v0.13.0

func WithRecvTimeout(d time.Duration) Option

WithRecvTimeout add recv timeout for stream.Recv function. NOTICE: ONLY effective for ttheader streaming protocol for now.

Deprecated: using WithRecvTimeoutConfig When WithRecvTimeout and WithRecvTimeoutConfig are both configured for ttstream, WithRecvTimeoutConfig has higher priority.

func WithRecvTimeoutConfig added in v0.16.0

func WithRecvTimeoutConfig(cfg streaming.TimeoutConfig) Option

WithRecvTimeoutConfig add recv timeout for stream.Recv function. By default, it will cancel the remote peer when timeout.

However, in certain scenarios (e.g., resume-enabled transfers: A → B → C), A may not wish to cancel B and C upon detecting a timeout. It expects B and C to complete one round of streaming communication and cache the results. This allows A to resume the request from the disconnected point on the next attempt, completing the resume-from-breakpoint process. Config like this:

WithRecvTimeoutConfig(streaming.TimeoutConfig{
		    Timeout: tm,
		    DisableCancelRemote: true,
})

The remote peer must promptly exit the handler; otherwise, there is a risk of stream leakage!

func WithTag

func WithTag(key, val string) Option

WithTag sets the tags for service discovery for an RPC call.

func WithURL

func WithURL(url string) Option

WithURL specifies the target for a RPC call with url. The given url will be resolved to hostport and overwrites the result from Resolver.

func (Option) GetCallOption deprecated

func (o Option) GetCallOption() callopt.Option

Deprecated: it's not supposed to be called by users directly and may be removed in future versions. GetCallOption returns a callopt.Option

Jump to

Keyboard shortcuts

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