examplestore

package
v0.0.0-...-e2cac0c Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Name commonstore.StoreName = "ExampleStore"

Define the index names of the stores, each of which should be different from the other.

Variables

This section is empty.

Functions

func NewCache

func NewCache(handler commoncache.CacheHandler) commonstore.Store

func NewSnapshot

func NewSnapshot(handler commoncache.CacheHandler) commonstore.Store

Types

type ExampleStore

type ExampleStore struct {
	// BaseStore is the `anonymous field` that implements all the ClusterEventsHandler interface as a base class.
	commonstore.BaseStore

	// Storage field support customization.
	// In general, we use generationstore.ListStore in Cache and generationstore.RawStore in snapshot,
	// and such data structures support multiple levels of nesting.
	Store generationstore.Store
	// contains filtered or unexported fields
}

ExampleStore implementing the Store interface.

func (*ExampleStore) AddPod

func (s *ExampleStore) AddPod(pod *v1.Pod) error

func (*ExampleStore) AssumePod

func (s *ExampleStore) AssumePod(podInfo *framework.CachePodInfo) error

AssumePod/ForgetPod will be called by Cache/Snapshot at the same time. If there is different logic it can be distinguished by storeType.

func (*ExampleStore) DeletePod

func (s *ExampleStore) DeletePod(pod *v1.Pod) error

func (*ExampleStore) ForgetPod

func (s *ExampleStore) ForgetPod(podInfo *framework.CachePodInfo) error

AssumePod/ForgetPod will be called by Cache/Snapshot at the same time. If there is different logic it can be distinguished by storeType.

func (*ExampleStore) GetPodCount

func (s *ExampleStore) GetPodCount(nodeName string) int

func (*ExampleStore) Name

func (*ExampleStore) UpdateNode

func (s *ExampleStore) UpdateNode(oldNode, newNode *v1.Node) error

func (*ExampleStore) UpdatePod

func (s *ExampleStore) UpdatePod(oldPod *v1.Pod, newPod *v1.Pod) error

ATTENTION: Previously, assumed pods were converted to bound pods by AddPod, but this is actually a pod update event. At this point, the oldPod does not carry information about the assume, so you MUST try to get the state of the once-assumed pod from the Cache.

func (*ExampleStore) UpdateSnapshot

func (s *ExampleStore) UpdateSnapshot(store commonstore.Store) error

UpdateSnapshot synchronize the data in the Cache to Snapshot, generally using generationstore for incremental updates.

type StoreHandle

type StoreHandle interface {
	GetPodCount(nodeName string) int
}

Jump to

Keyboard shortcuts

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