Documentation ¶
Index ¶
- Variables
- func CreateTiStore(urls string, credential *security.Credential) (tikv.Storage, error)
- func GetSafeResolvedTs(resolvedTs uint64) uint64
- func InitMetrics(registry *prometheus.Registry)
- func InitWorkerPool()
- func NewSizedRegionRouter(ctx context.Context, sizeLimit int) *sizedRegionRouter
- func RunWorkerPool(ctx context.Context) error
- type CDCClient
- type CDCKVClient
- type GrpcPool
- type GrpcPoolImpl
- type LimitRegionRouter
- type PullerInitialization
- type StorageWithCurVersionCache
- type TiKVStorage
Constants ¶
This section is empty.
Variables ¶
var NewCDCKVClient = NewCDCClient
NewCDCKVClient is the constructor of CDC KV client
Functions ¶
func CreateTiStore ¶
CreateTiStore creates a new tikv storage client
func GetSafeResolvedTs ¶
func InitMetrics ¶
func InitMetrics(registry *prometheus.Registry)
InitMetrics registers all metrics in the kv package
func InitWorkerPool ¶
func InitWorkerPool()
InitWorkerPool initialize workerpool once, the workerpool must be initialized before any kv event is received.
func NewSizedRegionRouter ¶
NewSizedRegionRouter creates a new sizedRegionRouter
func RunWorkerPool ¶
RunWorkerPool runs the worker pool used by the region worker in kv client v2 It must be running before region worker starts to work
Types ¶
type CDCClient ¶
type CDCClient struct {
// contains filtered or unexported fields
}
CDCClient to get events from TiKV
func (*CDCClient) EventFeed ¶
func (c *CDCClient) EventFeed( ctx context.Context, span regionspan.ComparableSpan, ts uint64, enableOldValue bool, lockResolver txnutil.LockResolver, isPullerInit PullerInitialization, eventCh chan<- model.RegionFeedEvent, ) error
EventFeed divides a EventFeed request on range boundaries and establishes a EventFeed to each of the individual region. It streams back result on the provided channel. The `Start` and `End` field in input span must be memcomparable encoded.
type CDCKVClient ¶
type CDCKVClient interface { EventFeed( ctx context.Context, span regionspan.ComparableSpan, ts uint64, enableOldValue bool, lockResolver txnutil.LockResolver, isPullerInit PullerInitialization, eventCh chan<- model.RegionFeedEvent, ) error }
CDCKVClient is an interface to receives kv changed logs from TiKV
func NewCDCClient ¶
func NewCDCClient(ctx context.Context, pd pd.Client, kvStorage tikv.Storage, grpcPool GrpcPool, regionCache *tikv.RegionCache) (c CDCKVClient)
NewCDCClient creates a CDCClient instance
type GrpcPool ¶
type GrpcPool interface { // GetConn returns an available gRPC ClientConn GetConn(target string) (*sharedConn, error) // ReleaseConn is called when a gRPC stream is released ReleaseConn(sc *sharedConn, target string) // Recycle recycles idle connections periodically RecycleConn(ctx context.Context) // Close tears down all ClientConns maintained in pool Close() }
GrpcPool defines an interface that can serve as a gPRC connection pool. It provides API to get a shared connection from pool and API to decrease usage reference of the shared connection
type GrpcPoolImpl ¶
type GrpcPoolImpl struct {
// contains filtered or unexported fields
}
GrpcPoolImpl implement GrpcPool interface
func NewGrpcPoolImpl ¶
func NewGrpcPoolImpl(ctx context.Context, credential *security.Credential) *GrpcPoolImpl
NewGrpcPoolImpl creates a new GrpcPoolImpl instance
func (*GrpcPoolImpl) GetConn ¶
func (pool *GrpcPoolImpl) GetConn(addr string) (*sharedConn, error)
GetConn implements GrpcPool.GetConn
func (*GrpcPoolImpl) RecycleConn ¶
func (pool *GrpcPoolImpl) RecycleConn(ctx context.Context)
RecycleConn implements GrpcPool.RecycleConn
func (*GrpcPoolImpl) ReleaseConn ¶
func (pool *GrpcPoolImpl) ReleaseConn(sc *sharedConn, addr string)
ReleaseConn implements GrpcPool.ReleaseConn
type LimitRegionRouter ¶
type LimitRegionRouter interface { // Chan returns a singleRegionInfo channel that can be consumed from Chan() <-chan singleRegionInfo // AddRegion adds an singleRegionInfo to buffer, this function is thread-safe AddRegion(task singleRegionInfo) // Acquire acquires one token Acquire(id string) // Release gives back one token, this function is thread-safe Release(id string) // Run runs in background and does some logic work Run(ctx context.Context) error }
LimitRegionRouter defines an interface that can buffer singleRegionInfo and provide token based consumption
type PullerInitialization ¶
type PullerInitialization interface {
IsInitialized() bool
}
PullerInitialization is a workaround to solved cyclic import.
type StorageWithCurVersionCache ¶
StorageWithCurVersionCache adds GetCachedCurrentVersion() to tikv.Storage
func (*StorageWithCurVersionCache) GetCachedCurrentVersion ¶
func (s *StorageWithCurVersionCache) GetCachedCurrentVersion() (version uint64, err error)
GetCachedCurrentVersion gets the cached version of currentVersion, and update the cache if necessary