Documentation ¶
Index ¶
- type CachingMap
- func (c *CachingMap[K, V]) ApplyAllChanges() error
- func (c *CachingMap[K, V]) ApplyDeletionsOnly() error
- func (c *CachingMap[K, V]) ApplyUpdatesOnly() error
- func (c *CachingMap[K, V]) Dataplane() ReadOnlyMap[K, V]
- func (c *CachingMap[K, V]) Desired() ReadWriteMap[K, V]
- func (c *CachingMap[K, V]) LoadCacheFromDataplane() error
- type DataplaneMap
- type ErrSlice
- type ReadOnlyMap
- type ReadWriteMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachingMap ¶
type CachingMap[K comparable, V comparable] struct { // contains filtered or unexported fields }
CachingMap provides a caching layer around a DataplaneMap, when one of the Apply methods is called, it applies a minimal set of changes to the dataplane map to bring it into sync with the desired state. Updating the desired state in and of itself has no effect on the dataplane.
CachingMap will load a cache of the dataplane state on the first call to ApplyXXX, or the cache can be loaded explicitly by calling LoadCacheFromDataplane(). This allows for client code to inspect the dataplane cache with IterDataplane and GetDataplane.
func New ¶
func New[K comparable, V comparable](name string, dpMap DataplaneMap[K, V]) *CachingMap[K, V]
func (*CachingMap[K, V]) ApplyAllChanges ¶
func (c *CachingMap[K, V]) ApplyAllChanges() error
ApplyAllChanges attempts to bring the dataplane map into sync with the desired state.
func (*CachingMap[K, V]) ApplyDeletionsOnly ¶
func (c *CachingMap[K, V]) ApplyDeletionsOnly() error
ApplyDeletionsOnly applies any pending deletions to the dataplane map. It doesn't add or update any keys that are new/changed.
func (*CachingMap[K, V]) ApplyUpdatesOnly ¶
func (c *CachingMap[K, V]) ApplyUpdatesOnly() error
ApplyUpdatesOnly applies any pending adds/updates to the dataplane map. It doesn't delete any keys that are no longer wanted.
func (*CachingMap[K, V]) Dataplane ¶
func (c *CachingMap[K, V]) Dataplane() ReadOnlyMap[K, V]
func (*CachingMap[K, V]) Desired ¶
func (c *CachingMap[K, V]) Desired() ReadWriteMap[K, V]
func (*CachingMap[K, V]) LoadCacheFromDataplane ¶
func (c *CachingMap[K, V]) LoadCacheFromDataplane() error
LoadCacheFromDataplane loads the contents of the DP map into the dataplane cache, allowing it to be queried with GetDataplane and IterDataplane.
type DataplaneMap ¶
type DataplaneMap[K comparable, V comparable] interface { Update(K, V) error Delete(K) error Load() (map[K]V, error) ErrIsNotExists(error) bool }
DataplaneMap is an interface of the underlying map that is being cached by the CachingMap. It implements interaction with the dataplane.
type ReadOnlyMap ¶
type ReadOnlyMap[K comparable, V any] interface { Get(k K) (v V, exists bool) Iter(func(k K, v V)) }
type ReadWriteMap ¶
type ReadWriteMap[K comparable, V any] interface { ReadOnlyMap[K, V] Set(k K, v V) Delete(k K) DeleteAll() }