resourceallocator

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultMaxSeriesParallelismNumRatio = 1000000
	DefaultMinimumConcurrency           = 1
	DefaultWaitTimeOut                  = time.Minute
)
View Source
const (
	GradientDesc = iota
)

Variables

View Source
var ErrResTypeNotFound = errors.New("resource type not found")

Functions

func AllocParallelismRes added in v1.1.0

func AllocParallelismRes(resourceType ResourceType, num int64) (int64, error)

func AllocRes

func AllocRes(resourceType ResourceType, num int64) (int64, int64, error)

func DefaultSeriesAllocateFunc

func DefaultSeriesAllocateFunc(seriesNum int64) error

func FreeParallelismRes added in v1.1.0

func FreeParallelismRes(resourceType ResourceType, num, totalNum int64) error

func FreeRes

func FreeRes(resourceType ResourceType, num, totalNum int64) error

func InitResAllocator

func InitResAllocator(threshold, minAllocNum, minShardsAllocNum, funcType int64, resType ResourceType, maxWaitTime time.Duration, ptNumPerNode uint32) error

Types

type BaseResAllocator

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

func NewBaseResAllocator

func NewBaseResAllocator(threshold, minAllocNum, funcType int64) (*BaseResAllocator, error)

func (*BaseResAllocator) Alloc

func (p *BaseResAllocator) Alloc(num int64) (int64, int64, error)

func (*BaseResAllocator) Free

func (p *BaseResAllocator) Free(num, totalNum int64)

type ChunkReaderResAllocator

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

func NewChunkReaderResAllocator

func NewChunkReaderResAllocator(threshold, minAllocNum, funcType int64) (*ChunkReaderResAllocator, error)

func (*ChunkReaderResAllocator) Alloc

func (p *ChunkReaderResAllocator) Alloc(num int64) (int64, int64, error)

func (*ChunkReaderResAllocator) AllocParallelism added in v1.1.0

func (p *ChunkReaderResAllocator) AllocParallelism(num int64) (int64, error)

not use

func (*ChunkReaderResAllocator) Free

func (p *ChunkReaderResAllocator) Free(num, totalNum int64)

func (*ChunkReaderResAllocator) FreeParallelism added in v1.1.0

func (p *ChunkReaderResAllocator) FreeParallelism(num int64, totalNum int64)

type ResourceManager

type ResourceManager interface {
	Alloc(num int64) (allocNum int64, totalNum int64, err error)
	Free(num, totalNum int64)
	AllocParallelism(num int64) (int64, error)
	FreeParallelism(num int64, totalNum int64)
}

type ResourceType

type ResourceType int64
const (
	ChunkReaderRes ResourceType = iota
	ShardsParallelismRes
	SeriesParallelismRes
	Bottom
)

type SeriesResAllocator

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

func NewSeriesParallelismAllocator

func NewSeriesParallelismAllocator(maxTime time.Duration, maxSeriesParallelism int64) *SeriesResAllocator

func (*SeriesResAllocator) Alloc

func (s *SeriesResAllocator) Alloc(num int64) (int64, int64, error)

func (*SeriesResAllocator) AllocParallelism added in v1.1.0

func (s *SeriesResAllocator) AllocParallelism(num int64) (int64, error)

not use

func (*SeriesResAllocator) Free

func (s *SeriesResAllocator) Free(num, totalNum int64)

func (*SeriesResAllocator) FreeParallelism added in v1.1.0

func (s *SeriesResAllocator) FreeParallelism(num int64, totalNum int64)

not use

type ShardParallelismAllocator

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

func NewShardsParallelismAllocator

func NewShardsParallelismAllocator(maxTime time.Duration, maxShardsParallelism, minShardsAllocNum int64, ptNumPerNode uint32) (*ShardParallelismAllocator, error)

func (*ShardParallelismAllocator) Alloc

func (s *ShardParallelismAllocator) Alloc(num int64) (int64, int64, error)

func (*ShardParallelismAllocator) AllocParallelism added in v1.1.0

func (s *ShardParallelismAllocator) AllocParallelism(num int64) (int64, error)

func (*ShardParallelismAllocator) Free

func (s *ShardParallelismAllocator) Free(num, totalNum int64)

func (*ShardParallelismAllocator) FreeParallelism added in v1.1.0

func (s *ShardParallelismAllocator) FreeParallelism(num int64, totalNum int64)

Jump to

Keyboard shortcuts

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