util

package
v0.0.0-...-503c688 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MinSchedulerInterval is the minimum interval between two scheduling.
	MinSchedulerInterval = atomic.NewDuration(200 * time.Millisecond)

	// MaxOverclockCount is the maximum number of overclock goroutine.
	MaxOverclockCount = int32(1)
)

Functions

This section is empty.

Types

type Component

type Component int

Component is ID for difference component

const (
	// UNKNOWN is for unknown component. It is only for test
	UNKNOWN Component = iota
	// DDL is for ddl component
	DDL
	// DistTask is for disttask component.
	DistTask
)

type GoroutinePool

type GoroutinePool interface {
	ReleaseAndWait()
	Tune(size int32)
	LastTunerTs() time.Time
	Cap() int32
	Running() int32
	Name() string
	GetOriginConcurrency() int32
}

GoroutinePool is a pool interface

type MockGPool

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

MockGPool is only for test

func NewMockGPool

func NewMockGPool(name string, concurrency int32) *MockGPool

NewMockGPool is only for test

func (*MockGPool) Cap

func (m *MockGPool) Cap() int32

Cap is only for test

func (*MockGPool) GetOriginConcurrency

func (m *MockGPool) GetOriginConcurrency() int32

GetOriginConcurrency is only for test

func (*MockGPool) GetQueueSize

func (*MockGPool) GetQueueSize() int64

GetQueueSize is only for test

func (*MockGPool) InFlight

func (*MockGPool) InFlight() int64

InFlight is only for test

func (*MockGPool) LastTunerTs

func (*MockGPool) LastTunerTs() time.Time

LastTunerTs is only for test

func (*MockGPool) LongRTT

func (*MockGPool) LongRTT() float64

LongRTT is to represent the baseline latency by tracking a measurement of the long term, less volatile RTT.

func (*MockGPool) MaxInFlight

func (*MockGPool) MaxInFlight() int64

MaxInFlight is only for test

func (*MockGPool) MaxPASS

func (*MockGPool) MaxPASS() uint64

MaxPASS is only for test

func (*MockGPool) MinRT

func (*MockGPool) MinRT() uint64

MinRT is only for test

func (*MockGPool) Name

func (m *MockGPool) Name() string

Name is only for test

func (*MockGPool) ReleaseAndWait

func (*MockGPool) ReleaseAndWait()

ReleaseAndWait is only for test

func (*MockGPool) Running

func (*MockGPool) Running() int32

Running is only for test

func (*MockGPool) ShortRTT

func (*MockGPool) ShortRTT() uint64

ShortRTT is to represent the current system latency by tracking a measurement of the short time, and more volatile RTT.

func (*MockGPool) Tune

func (m *MockGPool) Tune(concurrency int32)

Tune is only for test

func (*MockGPool) UpdateLongRTT

func (*MockGPool) UpdateLongRTT(_ func(float64) float64)

UpdateLongRTT is only for test

type PoolContainer

type PoolContainer struct {
	Pool      GoroutinePool
	Component Component
}

PoolContainer is a pool container

type ShardPoolMap

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

ShardPoolMap is a map with shard

func NewShardPoolMap

func NewShardPoolMap() *ShardPoolMap

NewShardPoolMap creates a shard pool map

func (*ShardPoolMap) Add

func (s *ShardPoolMap) Add(key string, pool *PoolContainer) error

Add adds a pool to the map

func (*ShardPoolMap) Del

func (s *ShardPoolMap) Del(key string)

Del deletes a pool to the map.

func (*ShardPoolMap) Iter

func (s *ShardPoolMap) Iter(fn func(pool *PoolContainer))

Iter iterates the map

Jump to

Keyboard shortcuts

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