resourceallocator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 5 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 ResTypeNotFound = errors.New("resource type not found")

Functions

func AllocRes

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

func DefaultSeriesAllocateFunc

func DefaultSeriesAllocateFunc(seriesNum 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) 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) Free

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

type ResourceManager

type ResourceManager interface {
	Alloc(num int64) (allocNum int64, totalNum int64, err error)
	Free(num, 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) Free

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

type ShardParallelismAllocator

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

func NewShardsParallelismAllocator

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

func (*ShardParallelismAllocator) Alloc

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

func (*ShardParallelismAllocator) Free

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

Jump to

Keyboard shortcuts

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