activity

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 3 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 activity is the daemon's short operator-facing history: what happened to the model store and the runtimes, by whom (the mesh, the operator, or the daemon's own housekeeping), and why. A fixed-size ring in memory — the operator wants to see "the mesh started a 30 GB download at 14:02", not a durable audit log.

Index

Constants

View Source
const (
	KindDownloadStarted = "download_started"
	KindDownloaded      = "downloaded"
	KindDownloadFailed  = "download_failed"
	KindLoaded          = "loaded"
	KindUnloaded        = "unloaded"
	KindEvicted         = "evicted"
	KindDeclined        = "declined"
	KindMissing         = "missing"
	KindUpdateAvailable = "update_available"
	KindAssignment      = "assignment"
	// KindResized: a loaded model was restarted with another slot count
	// (slots follow demand, or memory pressure took them back).
	KindResized = "resized"
)

Kinds of activity (api/openapi.yaml ActivityEvent.kind).

View Source
const (
	ActorMesh     = "mesh"
	ActorOperator = "operator"
	ActorDaemon   = "daemon"
)

Actors: who caused the event.

View Source
const DefaultCapacity = 200

DefaultCapacity is how many events a Ring keeps.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Time    time.Time `json:"time"`
	Kind    string    `json:"kind"`
	Actor   string    `json:"actor"`
	Model   string    `json:"model,omitempty"`
	Message string    `json:"message"`
	Detail  string    `json:"detail,omitempty"`
}

Event is one row of the feed.

type Ring

type Ring struct {
	// Events, when set, receives each event as an `activity` SSE event.
	Events *events.Hub
	// contains filtered or unexported fields
}

Ring keeps the last N events, newest first on read. Safe for concurrent use; a nil *Ring accepts and drops events so producers need no nil checks.

func New

func New(n int) *Ring

New builds a ring of capacity n (DefaultCapacity when n <= 0).

func (*Ring) Add

func (r *Ring) Add(e Event)

Add records an event, stamping Time when unset.

func (*Ring) List

func (r *Ring) List() []Event

List returns the events newest first.

func (*Ring) Record

func (r *Ring) Record(kind, actor, model, message, detail string)

Record is Add with the common fields spelled out.

Jump to

Keyboard shortcuts

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