temperature

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Score

func Score(relevance, temperature float64) float64

Temperature-weighted relevance: cold nodes deprioritized but still findable.

Types

type ColdHandler

type ColdHandler func(ctx context.Context, nodes []*store.Node)

type Config

type Config struct {
	DecayRate       float64
	AccessBoost     float64
	ColdThreshold   float64
	NotifyThreshold float64
	TickInterval    time.Duration
}

func DefaultConfig

func DefaultConfig() Config

type NodeStore

type NodeStore interface {
	BoostTemperatureBatch(ctx context.Context, ids []string, boost float64) error
	DecayTemperatures(ctx context.Context, factor float64) (int64, error)
	GetColdNodes(ctx context.Context, threshold float64) ([]*store.Node, error)
}

type TickResult

type TickResult struct {
	Decayed int64
	Cold    []*store.Node
}

type Tracker

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

func NewTracker

func NewTracker(s NodeStore, cfg Config, logger *slog.Logger) *Tracker

func (*Tracker) RecordAccess

func (t *Tracker) RecordAccess(ctx context.Context, ids []string) error

func (*Tracker) Run

func (t *Tracker) Run(ctx context.Context, handler ColdHandler)

func (*Tracker) Tick

func (t *Tracker) Tick(ctx context.Context, elapsed time.Duration) (*TickResult, error)

Jump to

Keyboard shortcuts

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