observation

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: GPL-3.0 Imports: 8 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

Index

Constants

View Source
const (
	CapacityRejectionCode = "observation_capacity"
)

Variables

View Source
var (
	ErrStaleRevision   = errors.New("observation revision is stale")
	ErrStaleGeneration = errors.New("observation generation is stale")
	ErrNotFound        = errors.New("observation not found")
	ErrCapacity        = errors.New("observation capacity exceeded")
)

Functions

This section is empty.

Types

type Generation

type Generation func(pluginID, instanceID string) (uint64, bool)

Generation resolves the current core-owned generation for an app instance.

type Record

type Record struct {
	PluginID          string
	Generation        uint64
	AdmissionSequence uint64
	Observation       protocol.Observation
}

Record is an observation plus identity that plugins cannot provide themselves.

func (Record) ID

func (r Record) ID() string

ID returns the stable identity used for replacement and explanation.

func (Record) Identity

func (r Record) Identity() presentation.Identity

type Source

type Source struct {
	PluginID   string
	Generation uint64
}

Source is authenticated process identity attached by pluginhost.

type Store

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

Store owns the latest unresolved observation for each stable identity.

func NewStore

func NewStore(generation Generation, now func() time.Time) *Store

func (*Store) Changes

func (s *Store) Changes() <-chan struct{}

func (*Store) Diagnostics

func (s *Store) Diagnostics() StoreDiagnostics

Diagnostics returns only core-generated counts, timestamps, and stable codes.

func (*Store) ExcludeExactRevisionWithoutSignal

func (s *Store) ExcludeExactRevisionWithoutSignal(id presentation.Identity, generation, revision uint64) bool

ExcludeExactRevisionWithoutSignal advances a process-local revision watermark even when the producer withdrew the live record before the host completed a Back fallback. A later revision or generation remains eligible.

func (*Store) ExcludeRevisionWithoutSignal

func (s *Store) ExcludeRevisionWithoutSignal(id presentation.Identity, generation, revision uint64) bool

ExcludeRevisionWithoutSignal excludes one deterministic revision from arbitration without waking the engine. Callers decide whether to continue local selection or stop until a later observation naturally signals work.

func (*Store) Publish

func (s *Store) Publish(source Source, value protocol.Observation) error

Publish validates identity/generation and applies a strictly newer revision.

func (*Store) ReleaseExactRevisionReservationWithoutSignal

func (s *Store) ReleaseExactRevisionReservationWithoutSignal(id presentation.Identity, generation, revision uint64)

ReleaseExactRevisionReservationWithoutSignal removes only a matching Back reservation. A committed exclusion watermark remains intact.

func (*Store) ReserveExactRevisionWithoutSignal

func (s *Store) ReserveExactRevisionWithoutSignal(id presentation.Identity, generation, revision uint64) bool

ReserveExactRevisionWithoutSignal preserves proof that one exact live revision was admitted while a synchronous Back callback is in flight.

func (*Store) Sequence

func (s *Store) Sequence() uint64

Sequence identifies the latest accepted observation-state mutation. Signals and internal exact-revision exclusions do not advance it.

func (*Store) Signal

func (s *Store) Signal()

Signal requests reevaluation after core-owned state such as acknowledgement changes.

func (*Store) Snapshot

func (s *Store) Snapshot() []Record

func (*Store) SnapshotWithSequence

func (s *Store) SnapshotWithSequence() ([]Record, uint64)

SnapshotWithSequence returns one owned snapshot and the accepted mutation sequence that produced it.

func (*Store) Withdraw

func (s *Store) Withdraw(pluginID, instanceID, channel, key string) error

func (*Store) WithdrawGeneration

func (s *Store) WithdrawGeneration(pluginID string, generation uint64)

WithdrawGeneration removes only records emitted by one child generation.

func (*Store) WithdrawInstance

func (s *Store) WithdrawInstance(pluginID, instanceID string, throughGeneration uint64)

WithdrawInstance removes retained observations through the last generation owned by a deleted app while preserving any later same-ID recreation.

type StoreDiagnostics

type StoreDiagnostics struct {
	LiveCount          int       `json:"live_count"`
	CapacityRejections uint64    `json:"capacity_rejections"`
	LastRejectionAt    time.Time `json:"last_rejection_at,omitempty"`
	LastRejectionCode  string    `json:"last_rejection_code,omitempty"`
}

StoreDiagnostics is a bounded, redacted view of observation-store health.

Jump to

Keyboard shortcuts

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