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

changes

package
v1.4.32 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 15 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")
	ErrLeaseLost    = errors.New("kubernetes changes: capture lease lost")
)

Functions

func CrashID added in v1.4.31

func CrashID(event CrashEvent) string

func DecodeRevision added in v1.4.31

func DecodeRevision(reader io.Reader) ([]string, error)

Types

type Change

type Change struct {
	RootUID         string        `json:"root_uid,omitempty"`
	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"`
	Source          string        `json:"source,omitempty"`
	Revision        string        `json:"revision,omitempty"`
	FieldsTruncated bool          `json:"fields_truncated,omitempty"`
	Coalesced       bool          `json:"coalesced,omitempty"`
	// contains filtered or unexported fields
}

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.

func DetectAll added in v1.4.31

func DetectAll(cluster string, delta index.Delta, at time.Time) []Change

func DetectContinuous added in v1.4.31

func DetectContinuous(cluster string, delta index.Delta, at time.Time) []Change

func Reconstruct added in v1.4.31

func Reconstruct(cluster string, records []index.Record, now time.Time) []Change

type CrashEvent added in v1.4.31

type CrashEvent struct {
	ID              string    `json:"id"`
	Sequence        uint64    `json:"sequence"`
	Cluster         string    `json:"cluster"`
	Namespace       string    `json:"namespace"`
	Pod             string    `json:"pod"`
	PodUID          string    `json:"pod_uid"`
	RootUID         string    `json:"root_uid"`
	RootKind        string    `json:"root_kind"`
	RootName        string    `json:"root_name"`
	AncestryPartial bool      `json:"ancestry_partial,omitempty"`
	Container       string    `json:"container"`
	Init            bool      `json:"init,omitempty"`
	Type            string    `json:"type"`
	TerminationSlot string    `json:"termination_slot,omitempty"`
	WaitingReason   string    `json:"waiting_reason,omitempty"`
	Reason          string    `json:"reason,omitempty"`
	ExitCode        int32     `json:"exit_code"`
	Signal          int32     `json:"signal,omitempty"`
	RestartCount    int32     `json:"restart_count"`
	At              time.Time `json:"at"`
	TimeSource      string    `json:"time_source"`
	ObservedAt      time.Time `json:"observed_at"`
}

func (CrashEvent) Valid added in v1.4.31

func (event CrashEvent) Valid() bool

type CrashPage added in v1.4.31

type CrashPage struct {
	CrashCount     int            `json:"crash_count"`
	Items          []CrashEvent   `json:"items"`
	Next           string         `json:"next,omitempty"`
	Since          time.Time      `json:"since"`
	Until          time.Time      `json:"until"`
	RetentionFrom  time.Time      `json:"retention_from"`
	RetentionBasis string         `json:"retention_basis"`
	StartedAt      time.Time      `json:"started_at"`
	Gaps           []Gap          `json:"gaps"`
	CaptureGaps    []Gap          `json:"capture_gaps"`
	Coverage       map[string]Gap `json:"coverage"`
	Limitations    []string       `json:"limitations"`
}

type CrashQuery added in v1.4.31

type CrashQuery struct {
	PodUID    string
	Since     time.Time
	Until     time.Time
	Namespace string
	RootUID   string
	Limit     int
	Cursor    string
}

CrashQuery bounds observation time; CrashEvent.At remains the actual event time.

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 Lease added in v1.4.31

type Lease struct {
	Owner   string    `json:"owner"`
	Expires time.Time `json:"expires"`
}

type Page

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

type Query

type Query struct {
	RootUID   string
	UIDs      map[string]bool
	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 NewView added in v1.4.31

func NewView(provider storage.Provider, scope index.Scope, archiveOrgs []string) (*Store, error)

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) BreakLogs added in v1.4.32

func (store *Store) BreakLogs(now time.Time) (breaklogs.State, error)

func (*Store) CheckCaptureLease added in v1.4.32

func (store *Store) CheckCaptureLease(owner string) error

func (*Store) ClaimLease added in v1.4.31

func (store *Store) ClaimLease(owner string, now time.Time, ttl time.Duration) error

func (*Store) Commit added in v1.4.31

func (store *Store) Commit(changes []Change, gaps []Gap, coverage map[string]Gap, owner string, now time.Time) error

func (*Store) CommitBreakLogs added in v1.4.32

func (store *Store) CommitBreakLogs(items []breaklogs.Snapshot, gaps []breaklogs.Gap, job, owner string, now time.Time) error

func (*Store) CommitCapture added in v1.4.31

func (store *Store) CommitCapture(changes []Change, gaps []Gap, coverage map[string]Gap, owner string, now time.Time, crashes []CrashEvent, crashGaps []Gap, podRead bool) error

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 a stable keyset page over the retained journal.

func (*Store) QueryCrashes added in v1.4.31

func (store *Store) QueryCrashes(query CrashQuery, now time.Time) (CrashPage, error)

func (*Store) ReadWindow added in v1.4.31

func (store *Store) ReadWindow(from, to, now time.Time) (Page, error)

func (*Store) ReleaseLease added in v1.4.31

func (store *Store) ReleaseLease(owner string) error

func (*Store) RenewLease added in v1.4.31

func (store *Store) RenewLease(owner string, now time.Time, ttl time.Duration) error

func (*Store) TimelineWindow added in v1.4.32

func (store *Store) TimelineWindow(since, until time.Time) ([]Change, []CrashEvent, []Gap, error)

TimelineWindow takes one scoped retained journal snapshot. Filtering and display paging happen after sources are merged, never independently per type.

type Type

type Type string
const (
	Created          Type = "created"
	Deleted          Type = "deleted"
	ImageChanged     Type = "image_changed"
	ReplicasChanged  Type = "replicas_changed"
	SpecChanged      Type = "spec_changed"
	RolloutStarted   Type = "rollout_started"
	RolloutCompleted Type = "rollout_completed"
	RolloutStalled   Type = "rollout_stalled"
	ConfigRefChanged Type = "config_ref_changed"
	ConfigChanged    Type = "config_changed"
	WarningBurst     Type = "warning_burst"
)

Jump to

Keyboard shortcuts

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