util

package
v1.1.0-beta.0...-70f5218 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllTiKVStores

func GetAllTiKVStores(
	ctx context.Context,
	pdClient StoreMeta,
	storeBehavior StoreBehavior,
) ([]*metapb.Store, error)

GetAllTiKVStores returns all TiKV stores registered to the PD client. The stores must not be a tombstone and must never contain a label `engine=tiflash`.

Types

type StoreBehavior

type StoreBehavior uint8

StoreBehavior is the action to do in GetAllTiKVStores when a non-TiKV store (e.g. TiFlash store) is found.

const (
	// ErrorOnTiFlash causes GetAllTiKVStores to return error when the store is
	// found to be a TiFlash node.
	ErrorOnTiFlash StoreBehavior = 0
	// SkipTiFlash causes GetAllTiKVStores to skip the store when it is found to
	// be a TiFlash node.
	SkipTiFlash StoreBehavior = 1
	// TiFlashOnly caused GetAllTiKVStores to skip the store which is not a
	// TiFlash node.
	TiFlashOnly StoreBehavior = 2
)

type StoreMeta

type StoreMeta interface {
	// GetAllStores gets all stores from pd.
	// The store may expire later. Caller is responsible for caching and taking care
	// of store change.
	GetAllStores(ctx context.Context, opts ...pd.GetStoreOption) ([]*metapb.Store, error)
}

StoreMeta is the required interface for a watcher. It is striped from pd.Client.

Jump to

Keyboard shortcuts

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