Documentation
¶
Index ¶
- type ClientOption
- func WithBackoffer(bo *retry.Backoffer) ClientOption
- func WithCustomTimeoutOption(timeout time.Duration) ClientOption
- func WithEnableFollowerHandle(enable bool) ClientOption
- func WithEnableRouterClient(enable bool) ClientOption
- func WithForwardingOption(enableForwarding bool) ClientOption
- func WithGRPCDialOptions(opts ...grpc.DialOption) ClientOption
- func WithInitMetricsOption(initMetrics bool) ClientOption
- func WithMaxErrorRetry(count int) ClientOption
- func WithMetricsLabels(labels prometheus.Labels) ClientOption
- func WithTSOServerProxyOption(useTSOServerProxy bool) ClientOption
- type DynamicOption
- type GetRegionOp
- type GetRegionOption
- type GetStoreOp
- type GetStoreOption
- type MetaStorageOp
- type MetaStorageOption
- type Option
- func (o *Option) GetEnableFollowerHandle() bool
- func (o *Option) GetEnableRouterClient() bool
- func (o *Option) GetEnableTSOFollowerProxy() bool
- func (o *Option) GetMaxTSOBatchWaitInterval() time.Duration
- func (o *Option) GetTSOClientRPCConcurrency() int
- func (o *Option) SetEnableFollowerHandle(enable bool)
- func (o *Option) SetEnableRouterClient(enable bool)
- func (o *Option) SetEnableTSOFollowerProxy(enable bool)
- func (o *Option) SetMaxTSOBatchWaitInterval(interval time.Duration) error
- func (o *Option) SetTSOClientRPCConcurrency(value int)
- type RegionsOp
- type RegionsOption
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 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 ¶
GetEnableFollowerHandle gets the Follower Handle enable option.
func (*Option) GetEnableRouterClient ¶
GetEnableRouterClient gets the router client option.
func (*Option) GetEnableTSOFollowerProxy ¶
GetEnableTSOFollowerProxy gets the TSO Follower Proxy option.
func (*Option) GetMaxTSOBatchWaitInterval ¶
GetMaxTSOBatchWaitInterval gets the max TSO batch wait interval option.
func (*Option) GetTSOClientRPCConcurrency ¶
GetTSOClientRPCConcurrency gets the TSO client RPC concurrency option.
func (*Option) SetEnableFollowerHandle ¶
SetEnableFollowerHandle set the Follower Handle option.
func (*Option) SetEnableRouterClient ¶
SetEnableRouterClient sets the router client option.
func (*Option) SetEnableTSOFollowerProxy ¶
SetEnableTSOFollowerProxy sets the TSO Follower Proxy option.
func (*Option) SetMaxTSOBatchWaitInterval ¶
SetMaxTSOBatchWaitInterval sets the max TSO batch wait interval option. It only accepts the interval value between 0 and 10ms.
func (*Option) SetTSOClientRPCConcurrency ¶
SetTSOClientRPCConcurrency sets the TSO client RPC concurrency option.
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