tsoutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultTSOProxyTimeout defines the default timeout value of TSP Proxying
	DefaultTSOProxyTimeout = 3 * time.Second
)

Variables

This section is empty.

Functions

func CompareTimestamp

func CompareTimestamp(tsoOne, tsoTwo *pdpb.Timestamp) int

CompareTimestamp is used to compare two timestamps. If tsoOne > tsoTwo, returns 1. If tsoOne = tsoTwo, returns 0. If tsoOne < tsoTwo, returns -1.

func CompareTimestampUint64

func CompareTimestampUint64(tsoOne, tsoTwo uint64) int

CompareTimestampUint64 is used to compare two timestamps. If tsoOne > tsoTwo, returns 1. If tsoOne = tsoTwo, returns 0. If tsoOne < tsoTwo, returns -1.

func ComposeTS

func ComposeTS(physical, logical int64) uint64

ComposeTS generate an `uint64` TS by passing the physical and logical parts.

func GenerateTS

func GenerateTS(ts *pdpb.Timestamp) uint64

GenerateTS generate an `uint64` TS by passing a `pdpb.Timestamp`.

func GenerateTimestamp

func GenerateTimestamp(physical time.Time, logical uint64) *pdpb.Timestamp

GenerateTimestamp generate a `pdpb.Timestamp` by passing `time.Time` and `uint64`

func ParseTS

func ParseTS(ts uint64) (time.Time, uint64)

ParseTS parses the ts to (physical,logical).

func ParseTSUint64

func ParseTSUint64(ts uint64) (physical uint64, logical uint64)

ParseTSUint64 parses the ts to (physical,logical).

func ParseTimestamp

func ParseTimestamp(ts pdpb.Timestamp) (time.Time, uint64)

ParseTimestamp parses `pdpb.Timestamp` to `time.Time`

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

Jump to

Keyboard shortcuts

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