session

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 4 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 session holds what kubeside observed while it was running.

kubeside writes nothing to disk, so retention did not disappear: it moved to RAM with a much smaller budget. That budget is enforced from the first release rather than discovered at 400MB on somebody's laptop.

Eviction is oldest-first and visible. A buffer that quietly drops the beginning of a session turns a gap into an apparent quiet period, which is the one failure this product cannot afford.

Index

Constants

View Source
const (
	// DefaultMaxEntriesPerApp bounds one app's live history.
	DefaultMaxEntriesPerApp = 2000
	// DefaultMaxBytesPerApp keeps one chatty app from spending the whole
	// budget before the global cap notices.
	DefaultMaxBytesPerApp = 4 << 20 // 4MB
	// DefaultMaxBytesTotal is the budget across every app.
	DefaultMaxBytesTotal = 100 << 20 // 100MB
)

Defaults, from docs/05-architecture.md.

Variables

This section is empty.

Functions

func Merge

func Merge(reconstructed, live []timeline.Entry) []timeline.Entry

Merge folds live observations into reconstructed history, newest first.

Types

type Limits

type Limits struct {
	MaxEntriesPerApp int
	MaxBytesPerApp   int
	MaxBytesTotal    int
}

Limits configure the buffers. Zero values take the defaults, so a caller cannot accidentally opt out of the cap.

type Store

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

Store holds one buffer per app, under a global byte budget.

func New

func New(l Limits) *Store

New builds a store. Nothing it holds ever reaches disk.

func (*Store) Bytes

func (s *Store) Bytes() int

Bytes is the total held across every app, which is what the global budget bounds.

func (*Store) Entries

func (s *Store) Entries(app string) []timeline.Entry

Entries returns one app's live history, newest first.

func (*Store) Horizon

func (s *Store) Horizon(app string) *timeline.Horizon

Horizon says where this app's live history begins, and why it begins there.

Two different facts, two different sentences: eviction is a cut in something that was known, and a session start is simply the moment kubeside began watching. Rendering either as silence would mislead.

func (*Store) Record

func (s *Store) Record(app string, e timeline.Entry)

Record adds one observation to an app's buffer.

A repeat of the entry already at the head is dropped: a caller that observes the same state twice is reporting a poll, not a change.

Jump to

Keyboard shortcuts

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