Documentation
¶
Index ¶
- Constants
- type Config
- type LocalDispatch
- type SendResult
- type SenderOption
- type ServerOption
- func WithForwardTarget(tn metadata.TNShard) ServerOption
- func WithServerEnableCompress(enable bool) ServerOption
- func WithServerMaxMessageSize(maxMessageSize int) ServerOption
- func WithServerMessageFilter(filter func(*txn.TxnRequest) bool) ServerOption
- func WithServerQueueBufferSize(value int) ServerOption
- func WithServerQueueWorkers(value int) ServerOption
- func WithTxnForwardHandler(handler func(context.Context, *txn.TxnRequest, *txn.TxnResponse) error) ServerOption
- func WithTxnSender(sender TxnSender) ServerOption
- type TxnRequestHandleFunc
- type TxnSender
- type TxnServer
Constants ¶
const ( TxnLocalHandle = iota TxnForwardWait TxnForwarding )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalDispatch ¶
type LocalDispatch func(metadata.TNShard) TxnRequestHandleFunc
LocalDispatch used to returns request handler on local, avoid rpc
type SendResult ¶ added in v0.5.1
type SendResult struct {
Responses []txn.TxnResponse
// contains filtered or unexported fields
}
SendResult wrapping []txn.TxnResponse for reuse
func (*SendResult) Release ¶ added in v0.5.1
func (sr *SendResult) Release()
Release release send result
type SenderOption ¶
type SenderOption func(*sender)
SenderOption option for create Sender
func WithSenderLocalDispatch ¶
func WithSenderLocalDispatch(localDispatch LocalDispatch) SenderOption
WithSenderLocalDispatch set options for dispatch request to local to avoid rpc call
type ServerOption ¶ added in v0.6.0
type ServerOption func(*server)
ServerOption option for create TxnServer
func WithForwardTarget ¶
func WithForwardTarget(tn metadata.TNShard) ServerOption
func WithServerEnableCompress ¶ added in v0.7.0
func WithServerEnableCompress(enable bool) ServerOption
WithServerEnableCompress enable compress
func WithServerMaxMessageSize ¶ added in v0.6.0
func WithServerMaxMessageSize(maxMessageSize int) ServerOption
WithServerMaxMessageSize set max rpc message size
func WithServerMessageFilter ¶ added in v0.6.0
func WithServerMessageFilter(filter func(*txn.TxnRequest) bool) ServerOption
set filter func. Requests can be modified or filtered out by the filter before they are processed by the handler.
func WithServerQueueBufferSize ¶ added in v0.8.0
func WithServerQueueBufferSize(value int) ServerOption
WithServerQueueBufferSize set queue buffer size
func WithServerQueueWorkers ¶ added in v0.8.0
func WithServerQueueWorkers(value int) ServerOption
WithServerQueueWorkers set worker number
func WithTxnForwardHandler ¶
func WithTxnForwardHandler( handler func(context.Context, *txn.TxnRequest, *txn.TxnResponse) error) ServerOption
func WithTxnSender ¶
func WithTxnSender(sender TxnSender) ServerOption
type TxnRequestHandleFunc ¶
type TxnRequestHandleFunc func(context.Context, *txn.TxnRequest, *txn.TxnResponse) error
TxnRequestHandleFunc txn request handle func
type TxnSender ¶
type TxnSender interface {
// Send send request to the specified TN node, and wait for response synchronously.
// For backend connectivity failures, the internal will retry for a bounded period
// while still respecting Context cancellation and deadlines.
Send(context.Context, []txn.TxnRequest) (*SendResult, error)
// Close the txn sender
Close() error
}
TxnSender is used to send transaction requests to the TN nodes.
type TxnServer ¶
type TxnServer interface {
// Start start the txn server
Start() error
// Close the txn server
Close() error
// RegisterMethodHandler register txn request handler func
RegisterMethodHandler(txn.TxnMethod, TxnRequestHandleFunc)
// SwitchTxnHandleStateTo switch txn handle state during tn migration
SwitchTxnHandleStateTo(state int, opts ...ServerOption) error
}
TxnServer receives and processes txn requests from TxnSender.
func NewTxnServer ¶
NewTxnServer create a txn server. One DNStore corresponds to one TxnServer