Help us shape the future of Go! Take the 2026 Go Developer Survey

changes

package
v1.4.30 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidQuery = errors.New("kubernetes changes: invalid query")
	ErrStoreLimit   = errors.New("kubernetes changes: stored snapshot exceeds limit")
)

Functions

This section is empty.

Types

type Change

type Change struct {
	ID        string        `json:"id"`
	Cluster   string        `json:"cluster"`
	Kind      string        `json:"kind"`
	Namespace string        `json:"namespace,omitempty"`
	Name      string        `json:"name"`
	UID       string        `json:"uid"`
	Type      Type          `json:"type"`
	Fields    []FieldChange `json:"fields,omitempty"`
	At        time.Time     `json:"at"`
	Service   string        `json:"service,omitempty"`
}

func Detect

func Detect(cluster string, delta index.Delta, at time.Time) (Change, bool)

Detect converts one applied projected index delta into a safe typed change.

type FieldChange

type FieldChange struct {
	Path string `json:"path"`
	From string `json:"from"`
	To   string `json:"to"`
}

type Gap

type Gap struct {
	From time.Time `json:"from"`
	To   time.Time `json:"to"`
}

type Page

type Page struct {
	Items []Change `json:"items"`
	Next  string   `json:"next,omitempty"`
	Gaps  []Gap    `json:"gaps,omitempty"`
}

type Query

type Query struct {
	Since     time.Time
	Until     time.Time
	Namespace string
	Kind      string
	Name      string
	Type      Type
	Limit     int
	Cursor    string
}

type Store

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

func NewStore

func NewStore(provider storage.Provider, scope index.Scope) *Store

NewStore creates a bounded timeline store isolated by the complete scope.

func (*Store) Append

func (store *Store) Append(changes []Change, now time.Time) error

Append adds projected changes and evicts only the oldest records as required by bounds.

func (*Store) MarkGap

func (store *Store) MarkGap(gap Gap) error

MarkGap records a bounded interval for which the timeline cannot guarantee completeness.

func (*Store) Query

func (store *Store) Query(query Query, now time.Time) (Page, error)

Query returns at most 500 newest matching changes and a numeric offset cursor.

type Type

type Type string
const (
	Created         Type = "created"
	Deleted         Type = "deleted"
	ImageChanged    Type = "image_changed"
	ReplicasChanged Type = "replicas_changed"
	SpecChanged     Type = "spec_changed"
)

Jump to

Keyboard shortcuts

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