Documentation ¶
Index ¶
- type EmptyErrAdapter
- type ErrAdapter
- type ErrorErrAdapter
- type ExistedBefore
- type Index
- type Locked
- func (index *Locked[Name, Tracked, Query, TrackErr, QueryErr, IndexT]) Query(query Query) (iter.Iter[Name], QueryErr)
- func (index *Locked[Name, Tracked, Query, TrackErr, QueryErr, IndexT]) Track(name Name, item Tracked) TrackErr
- func (index *Locked[Name, Tracked, Query, TrackErr, QueryErr, IndexT]) Untrack(name Name) ExistedBefore
- type Namespaced
- func (index *Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]) Query(query NamespacedQuery[Query]) (iter.Iter[types.NamespacedName], QueryErr)
- func (index *Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]) Track(name types.NamespacedName, item Tracked) TrackErr
- func (index *Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]) Untrack(name types.NamespacedName) ExistedBefore
- type NamespacedQuery
- type Selectors
- type Sets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmptyErrAdapter ¶
type EmptyErrAdapter struct{}
func (EmptyErrAdapter) Nil ¶
func (EmptyErrAdapter) Nil() util.Empty
type ErrAdapter ¶
type ErrorErrAdapter ¶
type ErrorErrAdapter struct{}
func (ErrorErrAdapter) IsErr ¶
func (ErrorErrAdapter) IsErr(err error) bool
func (ErrorErrAdapter) Nil ¶
func (ErrorErrAdapter) Nil() error
type ExistedBefore ¶
type ExistedBefore = mm.ExistedBefore
type Index ¶
type Index[Name any, Tracked any, Query any, TrackErr any, QueryErr any] interface { // Starts tracking an item. // The state of the index is the same as before calling the method if an error is returned. Track(name Name, item Tracked) TrackErr // Stops tracking an item. // Returns true if the item was not tracked before. Untrack(name Name) ExistedBefore // Returns all tracked items consistent with the query. // Read-only operation. Query(query Query) (iter.Iter[Name], QueryErr) }
type Locked ¶
type Locked[ Name any, Tracked any, Query any, TrackErr any, QueryErr any, IndexT Index[Name, Tracked, Query, TrackErr, QueryErr], ] struct { // contains filtered or unexported fields }
An Index wrapper that protects read/write operations with a RWMutex.
func (*Locked[Name, Tracked, Query, TrackErr, QueryErr, IndexT]) Query ¶
func (index *Locked[Name, Tracked, Query, TrackErr, QueryErr, IndexT]) Query( query Query, ) (iter.Iter[Name], QueryErr)
Note that the index is read-locked until the iterator is fully exhausted. If the loop is time-consuming, consider collecting the result to a slice first.
func (*Locked[Name, Tracked, Query, TrackErr, QueryErr, IndexT]) Track ¶
func (index *Locked[Name, Tracked, Query, TrackErr, QueryErr, IndexT]) Track( name Name, item Tracked, ) TrackErr
func (*Locked[Name, Tracked, Query, TrackErr, QueryErr, IndexT]) Untrack ¶
func (index *Locked[Name, Tracked, Query, TrackErr, QueryErr, IndexT]) Untrack( name Name, ) ExistedBefore
type Namespaced ¶
type Namespaced[ Tracked any, Query any, TrackErr any, QueryErr any, IndexT Index[string, Tracked, Query, TrackErr, QueryErr], ] struct { // contains filtered or unexported fields }
Isolates each namespace with a separate Index.
func NewNamespaced ¶
func NewNamespaced[ Tracked any, Query any, TrackErr any, QueryErr any, IndexT Index[string, Tracked, Query, TrackErr, QueryErr], ]( newIndex func() IndexT, queryErrAdapter ErrAdapter[QueryErr], ) *Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]
func (*Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]) Query ¶
func (index *Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]) Query( query NamespacedQuery[Query], ) (iter.Iter[types.NamespacedName], QueryErr)
func (*Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]) Track ¶
func (index *Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]) Track( name types.NamespacedName, item Tracked, ) TrackErr
func (*Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]) Untrack ¶
func (index *Namespaced[Tracked, Query, TrackErr, QueryErr, IndexT]) Untrack( name types.NamespacedName, ) ExistedBefore
type NamespacedQuery ¶
type Selectors ¶
type Selectors[Name comparable] struct { // contains filtered or unexported fields }
Stores a dictionary of label selectors.
func NewSelectors ¶
func NewSelectors[Name comparable]() *Selectors[Name]
func (*Selectors[Name]) Track ¶
func (indexer *Selectors[Name]) Track(name Name, rawSelector metav1.LabelSelector) error
Start tracking a selector or update an existing one with the same name. The selector object must be immutable.
func (*Selectors[Name]) Untrack ¶
func (indexer *Selectors[Name]) Untrack(name Name) ExistedBefore
Stop tracking a selector if it exists.
type Sets ¶
type Sets[Name comparable] struct { // contains filtered or unexported fields }
Maintains an index of known label sets. Efficiently queries the names of sets matching a selector.
func NewSets ¶
func NewSets[Name comparable]() *Sets[Name]
func (*Sets[Name]) Untrack ¶
func (indexer *Sets[Name]) Untrack(name Name) ExistedBefore
Click to show internal directories.
Click to hide internal directories.