callopt

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: Apache-2.0 Imports: 11 Imported by: 558 modules, 2,278 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package callopt contains options that control the behavior of client on request level.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(cos []Option, cfg rpcinfo.RPCConfig, svr remoteinfo.RemoteInfo, locks *client.ConfigLocks, httpResolver http.Resolver) string

Apply applies call options to the rpcinfo.RPCConfig and internal.RemoteInfo of kitex client. The return value records the name and arguments of each option. This function is for internal purpose only.

Types

type Option

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

Option is a series of options used at the beginning of a RPC call.

func WithConnectTimeout

func WithConnectTimeout(d time.Duration) Option

WithConnectTimeout specifies the connection timeout for a RPC call.

func WithHTTPHost

func WithHTTPHost(host string) Option

WithHTTPHost specifies host in http header(work when RPC over http).

func WithHostPort

func WithHostPort(hostport string) Option

WithHostPort specifies the target address for a RPC call. The given address will overwrite the result from Resolver.

func WithRPCTimeout

func WithRPCTimeout(d time.Duration) Option

WithRPCTimeout specifies the RPC timeout for a RPC call. FIXME: callopt.WithRPCTimeout works only when client.WithRPCTimeout or client.WithTimeoutProvider is specified.

func WithTag

func WithTag(key, val string) Option

WithTag sets the tags for service discovery for a 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.

Jump to

Keyboard shortcuts

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