Documentation ¶
Index ¶
- Constants
- func CompareTimestamp(tsoOne, tsoTwo *pdpb.Timestamp) int
- func CompareTimestampUint64(tsoOne, tsoTwo uint64) int
- func ComposeTS(physical, logical int64) uint64
- func GenerateTS(ts *pdpb.Timestamp) uint64
- func GenerateTimestamp(physical time.Time, logical uint64) *pdpb.Timestamp
- func ParseTS(ts uint64) (time.Time, uint64)
- func ParseTSUint64(ts uint64) (physical uint64, logical uint64)
- func ParseTimestamp(ts pdpb.Timestamp) (time.Time, uint64)
- type PDProtoFactory
- type PDProtoRequest
- type ProtoFactory
- type Request
- type TSODispatcher
- type TSOProtoFactory
- type TSOProtoRequest
Constants ¶
const ( // DefaultTSOProxyTimeout defines the default timeout value of TSP Proxying DefaultTSOProxyTimeout = 3 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func CompareTimestamp ¶
CompareTimestamp is used to compare two timestamps. If tsoOne > tsoTwo, returns 1. If tsoOne = tsoTwo, returns 0. If tsoOne < tsoTwo, returns -1.
func CompareTimestampUint64 ¶
CompareTimestampUint64 is used to compare two timestamps. If tsoOne > tsoTwo, returns 1. If tsoOne = tsoTwo, returns 0. If tsoOne < tsoTwo, returns -1.
func GenerateTS ¶
GenerateTS generate an `uint64` TS by passing a `pdpb.Timestamp`.
func GenerateTimestamp ¶
GenerateTimestamp generate a `pdpb.Timestamp` by passing `time.Time` and `uint64`
func ParseTSUint64 ¶
ParseTSUint64 parses the ts to (physical,logical).
Types ¶
type PDProtoFactory ¶
type PDProtoFactory struct { }
PDProtoFactory is the abstract factory for creating tso related data structures defined in the PD grpc service
type PDProtoRequest ¶
type PDProtoRequest struct {
// contains filtered or unexported fields
}
PDProtoRequest wraps the request and stream channel in the PD grpc service
type ProtoFactory ¶
type ProtoFactory interface {
// contains filtered or unexported methods
}
ProtoFactory is the abstract factory for creating tso related data structures defined in the grpc service
type Request ¶
type Request interface {
// contains filtered or unexported methods
}
Request is an interface wrapping tsopb.TsoRequest and pdpb.TsoRequest so they can be generally handled by the TSO dispatcher
func NewPDProtoRequest ¶
func NewPDProtoRequest(forwardedHost string, clientConn *grpc.ClientConn, request *pdpb.TsoRequest, stream pdpb.PD_TsoServer) Request
NewPDProtoRequest creats a PDProtoRequest and returns as a Request
func NewTSOProtoRequest ¶
func NewTSOProtoRequest(forwardedHost string, clientConn *grpc.ClientConn, request *tsopb.TsoRequest, stream tsopb.TSO_TsoServer) Request
NewTSOProtoRequest creats a TSOProtoRequest and returns as a Request
type TSODispatcher ¶
type TSODispatcher struct {
// contains filtered or unexported fields
}
TSODispatcher dispatches the TSO requests to the corresponding forwarding TSO channels.
func NewTSODispatcher ¶
func NewTSODispatcher(tsoProxyHandleDuration, tsoProxyBatchSize prometheus.Histogram) *TSODispatcher
NewTSODispatcher creates and returns a TSODispatcher
func (*TSODispatcher) DispatchRequest ¶
func (s *TSODispatcher) DispatchRequest( ctx context.Context, req Request, tsoProtoFactory ProtoFactory, doneCh <-chan struct{}, errCh chan<- error, updateServicePrimaryAddrChs ...chan<- struct{})
DispatchRequest is the entry point for dispatching/forwarding a tso request to the detination host
type TSOProtoFactory ¶
type TSOProtoFactory struct { }
TSOProtoFactory is the abstract factory for creating tso related data structures defined in the TSO grpc service
type TSOProtoRequest ¶
type TSOProtoRequest struct {
// contains filtered or unexported fields
}
TSOProtoRequest wraps the request and stream channel in the TSO grpc service