store

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 11 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 InitFakeDiffStore added in v1.16.0

func InitFakeDiffStore[T runtime.Object](objs []T) *fakeDiffStore[T]

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 InitMockStore added in v1.16.0

func InitMockStore[T runtime.Object](objects []T) BGPCPResourceStore[T]

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