store

package
v1.15.11 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStoreUninitialized = errors.New("the store has not initialized yet")
	ErrDiffUninitialized  = errors.New("diff not initialized for caller")
)

Functions

func NewFakeDiffStore

func NewFakeDiffStore[T runtime.Object]() *fakeDiffStore[T]

func NewMockBGPCPResourceStore

func NewMockBGPCPResourceStore[T runtime.Object]() *mockBGPCPResourceStore[T]

Types

type BGPCPResourceStore

type BGPCPResourceStore[T k8sRuntime.Object] interface {
	// GetByKey returns the latest version of the object with given key.
	GetByKey(key resource.Key) (item T, exists bool, err error)

	// List returns all items currently in the store.
	List() (items []T, err error)
}

BGPCPResourceStore is a wrapper around the resource.Store for the BGP Control Plane reconcilers usage. It automatically signals the BGP Control Plane whenever an event happens on the resource.

func NewBGPCPResourceStore

func NewBGPCPResourceStore[T k8sRuntime.Object](params bgpCPResourceStoreParams[T]) BGPCPResourceStore[T]

type DiffStore

type DiffStore[T k8sRuntime.Object] interface {
	// InitDiff initializes tracking io items to Diff for the given callerID.
	InitDiff(callerID string)

	// Diff returns a list of items that have been upserted (updated or inserted) and deleted
	// since InitDiff or the last call to Diff with the same callerID.
	// Init(callerID) has to be called before Diff(callerID).
	Diff(callerID string) (upserted []T, deleted []resource.Key, err error)

	// CleanupDiff cleans up all caller-specific diff state.
	CleanupDiff(callerID string)

	// GetByKey returns the latest version of the object with given key.
	GetByKey(key resource.Key) (item T, exists bool, err error)

	// List returns all items currently in the store.
	List() (items []T, err error)
}

DiffStore is a wrapper around the resource.Store. The diffStore tracks all changes made to it since the last time the user synced up. This allows a user to get a list of just the changed objects while still being able to query the full store for a full sync.

func NewDiffStore

func NewDiffStore[T k8sRuntime.Object](params diffStoreParams[T]) DiffStore[T]

Jump to

Keyboard shortcuts

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