opt

package
v0.0.0-...-6173d50 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 6 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientOption

type ClientOption func(*Option)

ClientOption configures client.

func WithBackoffer

func WithBackoffer(bo *retry.Backoffer) ClientOption

WithBackoffer configures the client with backoffer.

func WithCustomTimeoutOption

func WithCustomTimeoutOption(timeout time.Duration) ClientOption

WithCustomTimeoutOption configures the client with timeout option.

func WithEnableFollowerHandle

func WithEnableFollowerHandle(enable bool) ClientOption

WithEnableFollowerHandle configures the client with allow follower handle option.

func WithEnableRouterClient

func WithEnableRouterClient(enable bool) ClientOption

WithEnableRouterClient configures the client with router client option.

func WithForwardingOption

func WithForwardingOption(enableForwarding bool) ClientOption

WithForwardingOption configures the client with forwarding option.

func WithGRPCDialOptions

func WithGRPCDialOptions(opts ...grpc.DialOption) ClientOption

WithGRPCDialOptions configures the client with gRPC dial options.

func WithInitMetricsOption

func WithInitMetricsOption(initMetrics bool) ClientOption

WithInitMetricsOption configures the client with metrics labels.

func WithMaxErrorRetry

func WithMaxErrorRetry(count int) ClientOption

WithMaxErrorRetry configures the client max retry times when connect meets error.

func WithMetricsLabels

func WithMetricsLabels(labels prometheus.Labels) ClientOption

WithMetricsLabels configures the client with metrics labels.

func WithTSOServerProxyOption

func WithTSOServerProxyOption(useTSOServerProxy bool) ClientOption

WithTSOServerProxyOption configures the client to use TSO server proxy, i.e., the client will send TSO requests to the API leader (the TSO server proxy) which will forward the requests to the TSO servers.

type DynamicOption

type DynamicOption int

DynamicOption is used to distinguish the dynamic option type.

const (
	// MaxTSOBatchWaitInterval is the max TSO batch wait interval option.
	// It is stored as time.Duration and should be between 0 and 10ms.
	MaxTSOBatchWaitInterval DynamicOption = iota
	// EnableTSOFollowerProxy is the TSO Follower Proxy option.
	// It is stored as bool.
	EnableTSOFollowerProxy
	// EnableFollowerHandle is the follower handle option.
	EnableFollowerHandle
	// TSOClientRPCConcurrency controls the amount of ongoing TSO RPC requests at the same time in a single TSO client.
	TSOClientRPCConcurrency
	// EnableRouterClient is the router client option.
	// It is stored as bool.
	EnableRouterClient
)

type GetRegionOp

type GetRegionOp struct {
	NeedBuckets                  bool
	AllowFollowerHandle          bool
	OutputMustContainAllKeyRange bool
}

GetRegionOp represents available options when getting regions.

type GetRegionOption

type GetRegionOption func(op *GetRegionOp)

GetRegionOption configures GetRegionOp.

func WithAllowFollowerHandle

func WithAllowFollowerHandle() GetRegionOption

WithAllowFollowerHandle means that client can send request to follower and let it handle this request.

func WithBuckets

func WithBuckets() GetRegionOption

WithBuckets means getting region and its buckets.

func WithOutputMustContainAllKeyRange

func WithOutputMustContainAllKeyRange() GetRegionOption

WithOutputMustContainAllKeyRange means the output must contain all key ranges.

type GetStoreOp

type GetStoreOp struct {
	ExcludeTombstone bool
}

GetStoreOp represents available options when getting stores.

type GetStoreOption

type GetStoreOption func(*GetStoreOp)

GetStoreOption configures GetStoreOp.

func WithExcludeTombstone

func WithExcludeTombstone() GetStoreOption

WithExcludeTombstone excludes tombstone stores from the result.

type MetaStorageOp

type MetaStorageOp struct {
	RangeEnd         []byte
	Revision         int64
	PrevKv           bool
	Lease            int64
	Limit            int64
	IsOptsWithPrefix bool
}

MetaStorageOp represents available options when using meta storage client.

type MetaStorageOption

type MetaStorageOption func(*MetaStorageOp)

MetaStorageOption configures MetaStorageOp.

func WithLease

func WithLease(lease int64) MetaStorageOption

WithLease specifies the lease of the key.

func WithLimit

func WithLimit(limit int64) MetaStorageOption

WithLimit specifies the limit of the key.

func WithPrefix

func WithPrefix() MetaStorageOption

WithPrefix specifies the prefix of the key.

func WithPrevKV

func WithPrevKV() MetaStorageOption

WithPrevKV specifies the previous key-value pair of the key.

func WithRangeEnd

func WithRangeEnd(rangeEnd []byte) MetaStorageOption

WithRangeEnd specifies the range end of the key.

func WithRev

func WithRev(revision int64) MetaStorageOption

WithRev specifies the start revision of the key.

type Option

type Option struct {
	// Static options.
	GRPCDialOptions   []grpc.DialOption
	Timeout           time.Duration
	MaxRetryTimes     int
	EnableForwarding  bool
	UseTSOServerProxy bool
	MetricsLabels     prometheus.Labels
	InitMetrics       bool
	Backoffer         *retry.Backoffer

	EnableTSOFollowerProxyCh chan struct{}
	EnableFollowerHandleCh   chan struct{}
	EnableRouterClientCh     chan struct{}
	// contains filtered or unexported fields
}

Option is the configurable option for the PD client. It provides the ability to change some PD client's options online from the outside.

func NewOption

func NewOption() *Option

NewOption creates a new PD client option with the default values set.

func (*Option) GetEnableFollowerHandle

func (o *Option) GetEnableFollowerHandle() bool

GetEnableFollowerHandle gets the Follower Handle enable option.

func (*Option) GetEnableRouterClient

func (o *Option) GetEnableRouterClient() bool

GetEnableRouterClient gets the router client option.

func (*Option) GetEnableTSOFollowerProxy

func (o *Option) GetEnableTSOFollowerProxy() bool

GetEnableTSOFollowerProxy gets the TSO Follower Proxy option.

func (*Option) GetMaxTSOBatchWaitInterval

func (o *Option) GetMaxTSOBatchWaitInterval() time.Duration

GetMaxTSOBatchWaitInterval gets the max TSO batch wait interval option.

func (*Option) GetTSOClientRPCConcurrency

func (o *Option) GetTSOClientRPCConcurrency() int

GetTSOClientRPCConcurrency gets the TSO client RPC concurrency option.

func (*Option) SetEnableFollowerHandle

func (o *Option) SetEnableFollowerHandle(enable bool)

SetEnableFollowerHandle set the Follower Handle option.

func (*Option) SetEnableRouterClient

func (o *Option) SetEnableRouterClient(enable bool)

SetEnableRouterClient sets the router client option.

func (*Option) SetEnableTSOFollowerProxy

func (o *Option) SetEnableTSOFollowerProxy(enable bool)

SetEnableTSOFollowerProxy sets the TSO Follower Proxy option.

func (*Option) SetMaxTSOBatchWaitInterval

func (o *Option) SetMaxTSOBatchWaitInterval(interval time.Duration) error

SetMaxTSOBatchWaitInterval sets the max TSO batch wait interval option. It only accepts the interval value between 0 and 10ms.

func (*Option) SetTSOClientRPCConcurrency

func (o *Option) SetTSOClientRPCConcurrency(value int)

SetTSOClientRPCConcurrency sets the TSO client RPC concurrency option.

type RegionsOp

type RegionsOp struct {
	Group          string
	RetryLimit     uint64
	SkipStoreLimit bool
}

RegionsOp represents available options when operate regions

type RegionsOption

type RegionsOption func(op *RegionsOp)

RegionsOption configures RegionsOp

func WithGroup

func WithGroup(group string) RegionsOption

WithGroup specify the group during Scatter/Split Regions

func WithRetry

func WithRetry(retry uint64) RegionsOption

WithRetry specify the retry limit during Scatter/Split Regions

func WithSkipStoreLimit

func WithSkipStoreLimit() RegionsOption

WithSkipStoreLimit specify if skip the store limit check during Scatter/Split Regions

Jump to

Keyboard shortcuts

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