scheduler

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package scheduler orders runnable messages and enforces concurrency caps (RFC 6.5, R-CON-1): one worker per agent, a global worker cap, and a separate command-handler pool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Effective

func Effective(it Item, now time.Time, step time.Duration) int

Effective returns the priority after aging: one level per step waited, capped at urgent, so nothing starves.

func Order

func Order(items []Item, now time.Time, step time.Duration)

Order sorts items by effective priority (high first), then age.

Types

type Item

type Item struct {
	ID        string
	Agent     string
	Handler   string // command | worker
	Priority  int    // 0..3
	CreatedAt time.Time
}

Item is a runnable message.

type Slots

type Slots struct {
	MaxWorkers  int
	CommandPool int
	// contains filtered or unexported fields
}

Slots tracks what is running.

func NewSlots

func NewSlots(maxWorkers, pool int) *Slots

NewSlots returns empty slots.

func (*Slots) AgentBusy

func (s *Slots) AgentBusy(agent string) bool

AgentBusy reports whether a worker for agent is running.

func (*Slots) CanStart

func (s *Slots) CanStart(it Item) bool

CanStart reports whether an item may start now.

func (*Slots) Counts

func (s *Slots) Counts() (workers, commands int)

Counts returns running workers and commands.

func (*Slots) Release

func (s *Slots) Release(handler, agent string)

Release frees a slot.

func (*Slots) Take

func (s *Slots) Take(it Item, runID string)

Take reserves a slot.

Jump to

Keyboard shortcuts

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