scheduler

package
v0.0.0-...-ba854f2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory interface {
	// Value will return the total numbers of goods
	Value() int

	// Produce will produce numbers of goods
	Produce(goods int)

	// Consume will consume numbers of goods
	Consume(goods int) error
}

Factory is an interface that can produce and consume "goods"

type LRUScheduler

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

LRUScheduler is a Least Recently Used scheduler.

func (*LRUScheduler) Schedule

func (lru *LRUScheduler) Schedule(ctx context.Context) (Factory, error)

Schedule is to choose the next candidate.

type Scheduler

type Scheduler interface {
	// Return a chosed client
	Schedule(ctx context.Context) (Factory, error)
}

Scheduler is an interface that implement a function choosing an item from a items pool.

func NewLRUScheduler

func NewLRUScheduler(pool []Factory) (Scheduler, error)

NewLRUScheduler new a LRU scheduler.

Jump to

Keyboard shortcuts

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