upstream

package
v0.0.0-...-f79c7ce Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptureTopologyCfg

type CaptureTopologyCfg struct {
	*model.CaptureInfo

	// GCServiceID identify the cdc cluster gc service id
	GCServiceID string
	SessionTTL  int64
}

CaptureTopologyCfg stores the information of the capture topology.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages all upstream.

func NewManager

func NewManager(ctx context.Context, cfg CaptureTopologyCfg) *Manager

NewManager creates a new Manager. ctx will be used to initialize upstream spawned by this Manager.

func NewManager4Test

func NewManager4Test(pdClient pd.Client) *Manager

NewManager4Test returns a Manager for unit test.

func (*Manager) AddDefaultUpstream

func (m *Manager) AddDefaultUpstream(
	pdEndpoints []string,
	conf *security.Credential,
	pdClient pd.Client,
	etcdClient *etcd.Client,
) (*Upstream, error)

AddDefaultUpstream add the default upstream

func (*Manager) AddUpstream

func (m *Manager) AddUpstream(info *model.UpstreamInfo) *Upstream

AddUpstream adds an upstream and init it.

func (*Manager) Close

func (m *Manager) Close()

Close closes all upstreams. Please make sure it will only be called once when capture exits.

func (*Manager) Get

func (m *Manager) Get(upstreamID uint64) (*Upstream, bool)

Get gets a upstream by upstreamID.

func (*Manager) GetDefaultUpstream

func (m *Manager) GetDefaultUpstream() (*Upstream, error)

GetDefaultUpstream returns the default upstream

func (*Manager) Tick

func (m *Manager) Tick(ctx context.Context,
	globalState *orchestrator.GlobalReactorState,
) error

Tick checks and frees upstream that have not been used for a long time to save resources. It's a thread-safe method.

func (*Manager) Visit

func (m *Manager) Visit(visitor func(up *Upstream) error) error

Visit on each upstream, return error on the first

type Upstream

type Upstream struct {
	ID uint64

	PdEndpoints    []string
	SecurityConfig *security.Credential
	PDClient       pd.Client

	KVStorage   tidbkv.Storage
	RegionCache *tikv.RegionCache
	PDClock     pdutil.Clock
	GCManager   gc.Manager
	// contains filtered or unexported fields
}

Upstream holds resources of a TiDB cluster, it can be shared by many changefeeds and processors. All public fields and method of an upstream should be thread-safe. Please be careful that never change any exported field of an Upstream.

func NewUpstream4Test

func NewUpstream4Test(pdClient pd.Client) *Upstream

NewUpstream4Test new an upstream for unit test.

func (*Upstream) Close

func (up *Upstream) Close()

Close all resources.

func (*Upstream) Error

func (up *Upstream) Error() error

Error returns the error during init this stream

func (*Upstream) IsClosed

func (up *Upstream) IsClosed() bool

IsClosed returns true if the upstream is closed.

func (*Upstream) IsNormal

func (up *Upstream) IsNormal() bool

IsNormal returns true if the upstream is normal.

func (*Upstream) VerifyTiDBUser

func (up *Upstream) VerifyTiDBUser(ctx context.Context, username, password string) error

VerifyTiDBUser verify whether the username and password are valid in TiDB. It does the validation via the successfully build of a connection with upstream TiDB with the username and password.

Jump to

Keyboard shortcuts

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