Documentation ¶
Index ¶
- func CreateTiStore(urls string, credential *security.Credential) (tidbkv.Storage, error)
- func GetGlobalGrpcMetrics() *grpc_prometheus.ClientMetrics
- func GetSnapshotMeta(tiStore tidbkv.Storage, ts uint64) meta.Reader
- func InitMetrics(registry *prometheus.Registry)
- type MultiplexingEvent
- type SharedClient
- func (s *SharedClient) AllocSubscriptionID() SubscriptionID
- func (s *SharedClient) Close()
- func (s *SharedClient) RegionCount(subID SubscriptionID) uint64
- func (s *SharedClient) ResolveLock(subID SubscriptionID, targetTs uint64)
- func (s *SharedClient) Run(ctx context.Context) error
- func (s *SharedClient) Subscribe(subID SubscriptionID, span tablepb.Span, startTs uint64, ...)
- func (s *SharedClient) Unsubscribe(subID SubscriptionID)
- type SubscriptionID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTiStore ¶
CreateTiStore creates a tikv storage client Note: It will return a same storage if the urls connect to a same pd cluster, so must be careful when you call storage.Close().
func GetGlobalGrpcMetrics ¶
func GetGlobalGrpcMetrics() *grpc_prometheus.ClientMetrics
GetGlobalGrpcMetrics gets the global grpc metrics.
func GetSnapshotMeta ¶
GetSnapshotMeta returns tidb meta information
func InitMetrics ¶
func InitMetrics(registry *prometheus.Registry)
InitMetrics registers all metrics in the kv package
Types ¶
type MultiplexingEvent ¶
type MultiplexingEvent struct { model.RegionFeedEvent SubscriptionID SubscriptionID Start time.Time }
MultiplexingEvent wrap a region event with SubscriptionID to indicate which subscription it belongs to.
type SharedClient ¶
type SharedClient struct {
// contains filtered or unexported fields
}
SharedClient is shared by many tables to pull events from TiKV. All exported Methods are thread-safe.
func NewSharedClient ¶
func NewSharedClient( changefeed model.ChangeFeedID, cfg *config.ServerConfig, filterLoop bool, pd pd.Client, grpcPool *sharedconn.ConnAndClientPool, regionCache *tikv.RegionCache, pdClock pdutil.Clock, lockResolver txnutil.LockResolver, ) *SharedClient
NewSharedClient creates a client.
func (*SharedClient) AllocSubscriptionID ¶
func (s *SharedClient) AllocSubscriptionID() SubscriptionID
AllocSubscriptionID gets an ID can be used in `Subscribe`.
func (*SharedClient) Close ¶
func (s *SharedClient) Close()
Close closes the client. Must be called after `Run` returns.
func (*SharedClient) RegionCount ¶
func (s *SharedClient) RegionCount(subID SubscriptionID) uint64
RegionCount returns subscribed region count for the span.
func (*SharedClient) ResolveLock ¶
func (s *SharedClient) ResolveLock(subID SubscriptionID, targetTs uint64)
ResolveLock is a function. If outsider subscribers find a span resolved timestamp is advanced slowly or stopped, they can try to resolve locks in the given span.
func (*SharedClient) Subscribe ¶
func (s *SharedClient) Subscribe(subID SubscriptionID, span tablepb.Span, startTs uint64, eventCh chan<- MultiplexingEvent)
Subscribe the given table span. NOTE: `span.TableID` must be set correctly. It new a subscribedTable and store it in `s.totalSpans`, and send a rangeTask to `s.rangeTaskCh`. The rangeTask will be handled in `handleRangeTasks` goroutine.
func (*SharedClient) Unsubscribe ¶
func (s *SharedClient) Unsubscribe(subID SubscriptionID)
Unsubscribe the given table span. All covered regions will be deregistered asynchronously. NOTE: `span.TableID` must be set correctly.
type SubscriptionID ¶
type SubscriptionID uint64
SubscriptionID comes from `SharedClient.AllocSubscriptionID`.