quotagroup

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// 资源组同步的间隔, 秒
	QuotaGroupSyncInterval uint32 = 120
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Quota

type Quota struct {
	Name  string  // 资源组名
	Quota float32 // 资源组的配额值
}

资源组的fit值结构

type QuotaGroup

type QuotaGroup struct {
	ID          uint32                          // ID
	Name        string                          // 资源组名
	Quota       float32                         // 资源组的调度资源配额
	Description string                          // 资源组的描述
	InsertTime  uint64                          // 资源组的插入时间
	QueueGroup  *schedulingqueue.SchedulingTeam // 资源组的调度队列组
}

资源组结构

type QuotaGroupMgr

type QuotaGroupMgr struct {
	GroupMap      map[string]*QuotaGroup // 资源组表
	QuotaList     []Quota                // 所有资源组的quota值的列表
	MaxQuota      float32                // 资源组中最大的quota值
	MaxQuotaIndex int                    // 最大quota值元素的索引
	Mutex         sync.Mutex             // 访问锁
}

资源组管理器

func GetQuotaGroupMgr

func GetQuotaGroupMgr() *QuotaGroupMgr

获取模块的资源组管理器对象

func (*QuotaGroupMgr) AddTask

func (rg *QuotaGroupMgr) AddTask(
	groupName string,
	taskId taskmodel.TaskIdType,
	taskType uint32,
	priority uint32,
) error

向资源组中添加任务

func (*QuotaGroupMgr) GetTaskCount

func (rg *QuotaGroupMgr) GetTaskCount() (taskCount uint, err error)

获取调度中的任务总数

func (*QuotaGroupMgr) Init

func (rg *QuotaGroupMgr) Init() error

初始化资源组

func (*QuotaGroupMgr) Select

func (rg *QuotaGroupMgr) Select(
	retTaskId *taskmodel.TaskIdType,
	subtasks *[]taskmodel.SubtaskBody,
) error

选择要调度的资源组, 调度任务, 返回任务下被调度到的子任务列表 无法选出子任务时, retTaskId为0, subtasks返回的元素为空

type QuotaGroupRecord

type QuotaGroupRecord struct {
	ID          uint32
	Name        string
	Quota       float32
	Description string
	InsertTime  string
}

资源组记录定义

Jump to

Keyboard shortcuts

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