Documentation ¶
Index ¶
- Variables
- func CaptureAddrFromCtx(ctx context.Context) string
- func ChangefeedIDFromCtx(ctx context.Context) string
- func ConvertToUTF8(strBytes []byte, origEncoding string) string
- func DecodeV2Key(key []byte) ([]byte, error)
- func EncodeKeySpan(format, start, end string) ([]byte, []byte, error)
- func EncodeV2Key(key []byte) []byte
- func EncodeV2Range(start, end []byte) ([]byte, []byte)
- func GetLocalTimezone() (*time.Location, error)
- func GetTimezone(name string) (tz *time.Location, err error)
- func HandleErr(ctx context.Context, errCh <-chan error, errFn func(error))
- func HandleErrWithErrGroup(ctx context.Context, errCh <-chan error, errFn func(error)) *errgroup.Group
- func IsOwnerFromCtx(ctx context.Context) bool
- func KVStorageFromCtx(ctx context.Context) (tikv.Storage, error)
- func KeySpanInfoFromCtx(ctx context.Context) (uint64, string)
- func MonitorCancelLatency(ctx context.Context, identifier string) func()
- func ParseKey(format, key string) ([]byte, error)
- func PutCaptureAddrInCtx(ctx context.Context, captureAddr string) context.Context
- func PutChangefeedIDInCtx(ctx context.Context, changefeedID string) context.Context
- func PutEventFilterInCtx(ctx context.Context, filter *KvFilter) context.Context
- func PutKVStorageInCtx(ctx context.Context, store tikv.Storage) context.Context
- func PutKeySpanInfoInCtx(ctx context.Context, keyspanID uint64, keyspanName string) context.Context
- func PutTimezoneInCtx(ctx context.Context, timezone *time.Location) context.Context
- func SetOwnerInCtx(ctx context.Context) context.Context
- func TimezoneFromCtx(ctx context.Context) *time.Location
- func ValidKeyFormat(format, start, end string) error
- func WaitSomething(nRetry int, waitTime time.Duration, fn func() bool) bool
- func ZapFieldCapture(ctx context.Context) zap.Field
- func ZapFieldChangefeed(ctx context.Context) zap.Field
- type Covering
- type Flag
- type KvFilter
- type KvFilterConfig
- type Range
Constants ¶
This section is empty.
Variables ¶
var ( // APIV2RawKeyPrefix is prefix of raw key in API V2. APIV2RawKeyPrefix = []byte{'r', 0, 0, 0} // APIV2RawEndKey is max key of raw key in API V2. APIV2RawEndKey = []byte{'r', 0, 0, 1} )
var FailpointBuild = isFailpointBuild()
FailpointBuild is ture if this is a failpoint build
Functions ¶
func CaptureAddrFromCtx ¶
CaptureAddrFromCtx returns a capture ID stored in the specified context. It returns an empty string if there's no valid capture ID found.
func ChangefeedIDFromCtx ¶
ChangefeedIDFromCtx returns a changefeedID stored in the specified context. It returns an empty string if there's no valid changefeed ID found.
func ConvertToUTF8 ¶
func DecodeV2Key ¶
func EncodeKeySpan ¶
EncodeKeySpan parse user input key and encode them to apiv2 format.
func EncodeV2Key ¶
EncodeV2Key encode a user key into API V2 format.
func EncodeV2Range ¶
EncodeV2Range encode a range into API V2 format. TODO: resue code in client-go
func GetLocalTimezone ¶
GetLocalTimezone returns the timezone in local system
func GetTimezone ¶
GetTimezone returns the timezone specified by the name
func HandleErrWithErrGroup ¶
func HandleErrWithErrGroup(ctx context.Context, errCh <-chan error, errFn func(error)) *errgroup.Group
HandleErrWithErrGroup creates a `errgroup.Group` and calls `HandleErr` within the error group
func IsOwnerFromCtx ¶
IsOwnerFromCtx returns true if this capture is owner
func KVStorageFromCtx ¶
KVStorageFromCtx returns a tikv store
func KeySpanInfoFromCtx ¶
KeySpanInfoFromCtx returns a kyspan ID & name
func MonitorCancelLatency ¶
MonitorCancelLatency monitors the latency from ctx being cancelled and the returned function being called
func ParseKey ¶
ParseKey parse key by given format. TODO: same code with br/pkg/utils/key.go, need make them common.
func PutCaptureAddrInCtx ¶
PutCaptureAddrInCtx returns a new child context with the specified capture ID stored.
func PutChangefeedIDInCtx ¶
PutChangefeedIDInCtx returns a new child context with the specified changefeed ID stored.
func PutEventFilterInCtx ¶
func PutKVStorageInCtx ¶
PutKVStorageInCtx returns a new child context with the given tikv store
func PutKeySpanInfoInCtx ¶
PutKeySpanInfoInCtx returns a new child context with the specified keyspan ID and name stored.
func PutTimezoneInCtx ¶
PutTimezoneInCtx returns a new child context with the given timezone
func SetOwnerInCtx ¶
SetOwnerInCtx returns a new child context with the owner flag set.
func TimezoneFromCtx ¶
TimezoneFromCtx returns a timezone
func ValidKeyFormat ¶
func WaitSomething ¶
WaitSomething waits for something done with `true`, it retrys for nRetry times at most
func ZapFieldCapture ¶
ZapFieldCapture returns a zap field containing capture address TODO: log redact for capture address
Types ¶
type Covering ¶
type Covering []Range
Covering represents a non-overlapping, but possibly non-contiguous, set of intervals.
type KvFilter ¶
type KvFilter struct {
// contains filtered or unexported fields
}
func CreateFilter ¶
func CreateFilter(conf *KvFilterConfig) *KvFilter
func EventFilterFromCtx ¶
type KvFilterConfig ¶
type KvFilterConfig struct { // Binary data is specified in escaped format, e.g. \x00\x01 KeyPrefix string `toml:"key-prefix" json:"key-prefix"` KeyPattern string `toml:"key-pattern" json:"key-pattern"` ValuePattern string `toml:"value-pattern" json:"value-pattern"` }
func (*KvFilterConfig) Validate ¶
func (c *KvFilterConfig) Validate() error
type Range ¶
Range is an interval with a payload.
func OverlapCoveringMerge ¶
OverlapCoveringMerge returns the set of intervals covering every range in the input such that no output range crosses an input endpoint. The payloads are returned as a `[]interface{}` and in the same order as they are in coverings.
Example:
covering 1: [1, 2) -> 'a', [3, 4) -> 'b', [6, 7) -> 'c' covering 2: [1, 5) -> 'd' output: [1, 2) -> 'ad', [2, 3) -> `d`, [3, 4) -> 'bd', [4, 5) -> 'd', [6, 7) -> 'c'
The input is mutated (sorted). It is also assumed (and not checked) to be valid (e.g. non-overlapping intervals in each covering).