apiidentity

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 16 Imported by: ? 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 apiidentity derives the APIIdentity view from APIExports. An identity is held by every APIExport whose status carries its hash; the view names the owner and the other holders. Nothing is stored: the view is computed from the APIExports replicated to the cache server, which are ordinary per-shard data, so it is the same on every shard and needs no coordination between them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCoreExport

func IsCoreExport(export *apisv1alpha2.APIExport) bool

IsCoreExport reports whether the export is one of the core APIExports in the root workspace, whose identities every shard needs before it can serve.

func Project

func Project(hash string, exports []*apisv1alpha2.APIExport, isCore func(*apisv1alpha2.APIExport) bool) *adminv1alpha1.APIIdentity

Project computes the view of one identity from the exports holding it. The owner is the oldest export, by creation time, then cluster, then name, so every reader of the same exports agrees on it; the others are holders. It returns nil when no export holds the identity.

Types

type Projector

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

Projector keeps the view of every identity current from APIExport events and serves it: by name, as a list, as a watch, and to event handlers. It is an event handler for an APIExport informer, normally the one against the cache server. Resource versions are its own, counting the changes of the view; a watch resuming from one it no longer remembers is told to relist, like a watch on an apiserver.

func NewProjector

func NewProjector(isCore func(*apisv1alpha2.APIExport) bool) *Projector

NewProjector creates a projector. isCore tells which exports are the core ones of the installation; IsCoreExport is the usual choice.

func (*Projector) AddEventHandler

func (p *Projector) AddEventHandler(handler cache.ResourceEventHandler)

AddEventHandler registers a handler for the changes of the view. It gets the current entries first, as initial adds. Handlers run with the projector's lock held and must not call back into it.

func (*Projector) Get

func (p *Projector) Get(name string) (*adminv1alpha1.APIIdentity, bool)

Get returns the view of the named identity.

func (*Projector) List

func (p *Projector) List(selector labels.Selector) []*adminv1alpha1.APIIdentity

List returns the views matching the selector, by name.

func (*Projector) OnAdd

func (p *Projector) OnAdd(obj any, _ bool)

func (*Projector) OnDelete

func (p *Projector) OnDelete(obj any)

func (*Projector) OnUpdate

func (p *Projector) OnUpdate(oldObj, newObj any)

func (*Projector) ResourceVersion

func (p *Projector) ResourceVersion() string

ResourceVersion is the version of the view: the number of changes so far.

func (*Projector) Watch

func (p *Projector) Watch(selector labels.Selector, opts WatchOptions) (watch.Interface, error)

Watch streams the changes of the entries matching the selector.

type WatchOptions

type WatchOptions struct {
	// ResourceVersion is where to start: "" for now, "0" for the current
	// entries followed by changes, otherwise the changes after that version.
	ResourceVersion string
	// SendInitialEvents asks for the current entries first, closed by a
	// bookmark when AllowWatchBookmarks is set, as a watch-list client does.
	SendInitialEvents   bool
	AllowWatchBookmarks bool
}

WatchOptions are the watch semantics a client asks for.

Jump to

Keyboard shortcuts

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