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 ¶
- func IsCoreExport(export *apisv1alpha2.APIExport) bool
- func Project(hash string, exports []*apisv1alpha2.APIExport, ...) *adminv1alpha1.APIIdentity
- type Projector
- func (p *Projector) AddEventHandler(handler cache.ResourceEventHandler)
- func (p *Projector) Get(name string) (*adminv1alpha1.APIIdentity, bool)
- func (p *Projector) List(selector labels.Selector) []*adminv1alpha1.APIIdentity
- func (p *Projector) OnAdd(obj any, _ bool)
- func (p *Projector) OnDelete(obj any)
- func (p *Projector) OnUpdate(oldObj, newObj any)
- func (p *Projector) ResourceVersion() string
- func (p *Projector) Watch(selector labels.Selector, opts WatchOptions) (watch.Interface, error)
- type WatchOptions
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) ResourceVersion ¶
ResourceVersion is the version of the view: the number of changes so far.
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.