store

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 18 Imported by: 7

Documentation

Index

Constants

View Source
const ManifestWorkFinalizer = "cloudevents.open-cluster-management.io/manifest-work-cleanup"

Variables

This section is empty.

Functions

func WaitForStoreInit

func WaitForStoreInit(ctx context.Context, cacheSyncs ...StoreInitiated) bool

Types

type AgentInformerWatcherStore

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

AgentInformerWatcherStore extends the baseStore. It gets/lists the works from the given informer store and send the work add/update/delete event to the watch channel directly.

It is used for building ManifestWork agent client.

func NewAgentInformerWatcherStore

func NewAgentInformerWatcherStore() *AgentInformerWatcherStore

func (*AgentInformerWatcherStore) Add

func (*AgentInformerWatcherStore) Delete

func (*AgentInformerWatcherStore) Get

func (b *AgentInformerWatcherStore) Get(namespace, name string) (*workv1.ManifestWork, bool, error)

Get a works from the store

func (*AgentInformerWatcherStore) GetWatcher

func (s *AgentInformerWatcherStore) GetWatcher(namespace string, opts metav1.ListOptions) (watch.Interface, error)

func (*AgentInformerWatcherStore) HandleReceivedWork

func (s *AgentInformerWatcherStore) HandleReceivedWork(action types.ResourceAction, work *workv1.ManifestWork) error

func (*AgentInformerWatcherStore) HasInitiated

func (s *AgentInformerWatcherStore) HasInitiated() bool

func (*AgentInformerWatcherStore) List

func (b *AgentInformerWatcherStore) List(namespace string, opts metav1.ListOptions) (*workv1.ManifestWorkList, error)

List the works from the store with the list options

func (*AgentInformerWatcherStore) ListAll

func (b *AgentInformerWatcherStore) ListAll() ([]*workv1.ManifestWork, error)

List all of works from the store

func (*AgentInformerWatcherStore) SetStore

func (s *AgentInformerWatcherStore) SetStore(store cache.Store)

func (*AgentInformerWatcherStore) Update

type ListLocalWorksFunc

type ListLocalWorksFunc func(ctx context.Context) ([]*workv1.ManifestWork, error)

ListLocalWorksFunc loads the works from the local environment.

type SourceInformerWatcherStore

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

SourceInformerWatcherStore extends the baseStore. It gets/lists the works from the given informer store and send the work add/update/delete event to the watch channel directly.

It is used for building ManifestWork source client.

func NewSourceInformerWatcherStore

func NewSourceInformerWatcherStore(ctx context.Context) *SourceInformerWatcherStore

func (*SourceInformerWatcherStore) Add

func (*SourceInformerWatcherStore) Delete

func (*SourceInformerWatcherStore) GetWatcher

func (s *SourceInformerWatcherStore) GetWatcher(namespace string, opts metav1.ListOptions) (watch.Interface, error)

func (*SourceInformerWatcherStore) HandleReceivedWork

func (bs *SourceInformerWatcherStore) HandleReceivedWork(action types.ResourceAction, work *workv1.ManifestWork) error

func (*SourceInformerWatcherStore) HasInitiated

func (s *SourceInformerWatcherStore) HasInitiated() bool

func (*SourceInformerWatcherStore) SetStore

func (s *SourceInformerWatcherStore) SetStore(store cache.Store)

func (*SourceInformerWatcherStore) Update

type SourceLocalWatcherStore

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

SourceLocalWatcherStore caches the works in this local store and provide the watch ability by watch event channel.

It is used for building ManifestWork source client.

func NewSourceLocalWatcherStore

func NewSourceLocalWatcherStore(ctx context.Context, listFunc ListLocalWorksFunc) (*SourceLocalWatcherStore, error)

NewSourceLocalWatcherStore returns a LocalWatcherStore with works that list by ListLocalWorksFunc

func (*SourceLocalWatcherStore) Add

Add a work to the cache and send an event to the event queue

func (*SourceLocalWatcherStore) Delete

Delete a work from the cache and send an event to the event queue

func (*SourceLocalWatcherStore) GetWatcher

func (s *SourceLocalWatcherStore) GetWatcher(namespace string, opts metav1.ListOptions) (watch.Interface, error)

func (*SourceLocalWatcherStore) HandleReceivedWork

func (bs *SourceLocalWatcherStore) HandleReceivedWork(action types.ResourceAction, work *workv1.ManifestWork) error

func (*SourceLocalWatcherStore) HasInitiated

func (s *SourceLocalWatcherStore) HasInitiated() bool

func (*SourceLocalWatcherStore) Update

Update a work in the cache and send an event to the event queue

type StoreInitiated

type StoreInitiated func() bool

StoreInitiated is a function that can be used to determine if a store has initiated.

type WorkClientWatcherStore

type WorkClientWatcherStore interface {
	// GetWatcher returns a watcher to receive work changes.
	GetWatcher(namespace string, opts metav1.ListOptions) (watch.Interface, error)

	// HandleReceivedWork handles the client received work events.
	HandleReceivedWork(action types.ResourceAction, work *workv1.ManifestWork) error

	// Add will be called by work client when adding works. The implementation is based on the specific
	// watcher store, in some case, it does not need to update a store, but just send a watch event.
	Add(work *workv1.ManifestWork) error

	// Update will be called by work client when updating works. The implementation is based on the specific
	// watcher store, in some case, it does not need to update a store, but just send a watch event.
	Update(work *workv1.ManifestWork) error

	// Delete will be called by work client when deleting works. The implementation is based on the specific
	// watcher store, in some case, it does not need to update a store, but just send a watch event.
	Delete(work *workv1.ManifestWork) error

	// List returns the works from store for a given namespace with list options
	List(namespace string, opts metav1.ListOptions) (*workv1.ManifestWorkList, error)

	// ListAll list all of the works from store
	ListAll() ([]*workv1.ManifestWork, error)

	// Get returns a work from store with work namespace and name
	Get(namespace, name string) (*workv1.ManifestWork, bool, error)

	// HasInitiated marks the store has been initiated, A resync may be required after the store is initiated
	// when building a work client.
	HasInitiated() bool
}

WorkClientWatcherStore provides a watcher with a work store.

Jump to

Keyboard shortcuts

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