utils

package
v0.0.0-...-896c3f5 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapCluster

func BootstrapCluster(ctx context.Context, cli pdpb.PDClient, header *pdpb.RequestHeader, version string)

BootstrapCluster tries to bootstrap a cluster with the given header and version.

func PutStores

func PutStores(ctx context.Context, cli pdpb.PDClient, header *pdpb.RequestHeader, stores []*metapb.Store)

PutStores puts the given stores to the cluster.

func ShowStats

func ShowStats(
	ctx context.Context,
	wg *sync.WaitGroup,
	durCh <-chan time.Duration,
	interval time.Duration,
	verbose bool,
	promServer *httptest.Server,
)

ShowStats shows the current stats and updates them with the given duration.

Types

type Regions

type Regions struct {

	// Regions is the list of all regions to heartbeat.
	Regions []*pdpb.RegionHeartbeatRequest
	// AwakenRegions is the number of regions to awaken.
	AwakenRegions atomic.Value

	UpdateRound int
	// contains filtered or unexported fields
}

Regions simulates all regions to heartbeat.

func NewRegions

func NewRegions(regionCount, replicaCount, storeCount int, header *pdpb.RequestHeader) *Regions

NewRegions initializes the regions with the given region count and replica count.

func (*Regions) HandleRegionHeartbeat

func (rs *Regions) HandleRegionHeartbeat(wg *sync.WaitGroup, stream pdpb.PD_RegionHeartbeatClient, storeID uint64, rep report.Report)

HandleRegionHeartbeat handles the region heartbeat for the given store.

func (*Regions) Result

func (rs *Regions) Result(regionCount int, sec float64)

Result prints the result of the region heartbeat.

func (*Regions) Update

func (rs *Regions) Update(regionCount, replicaCount int, options *config.Options)

Update updates the regions with the given options.

type Stats

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

Stats is used to collect and calculate the latency performance.

func NewStats

func NewStats() *Stats

NewStats creates a new stats instance.

func (*Stats) Update

func (s *Stats) Update(dur time.Duration)

Update updates the stats with the given duration.

Jump to

Keyboard shortcuts

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