cache

package
v0.0.0-...-eec02a6 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeCache

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

func NewNodeCache

func NewNodeCache() *NodeCache

func (*NodeCache) Delete

func (nc *NodeCache) Delete(name string)

Delete removes the node from cache. Does nothing if node does not exist. Delete should only be used with the global lock.

func (*NodeCache) Get

func (nc *NodeCache) Get(name string) *models.Node

Get returns a node by name, or nil if the node is not found

func (*NodeCache) Len

func (nc *NodeCache) Len() int

Len returns the number of nodes in cache

func (*NodeCache) List

func (nc *NodeCache) List() []*models.Node

List returns nodes in cache as an unordered slice that is safe to modify.

func (*NodeCache) Set

func (nc *NodeCache) Set(name string, node *models.Node)

Set adds or updates node in cache. Set should only be used with the global lock.

type VolumePublicationCache

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

func NewVolumePublicationCache

func NewVolumePublicationCache() *VolumePublicationCache

NewVolumePublicationCache returns a new reference to a VolumePublicationCache.

func (*VolumePublicationCache) Clear

func (vpc *VolumePublicationCache) Clear()

Clear wipes all data from the internal map. This expects the core's global lock is held.

func (*VolumePublicationCache) Delete

func (vpc *VolumePublicationCache) Delete(volume, node string) error

Delete removes an entry from the cache. If no node to publications exist for that entry, that structure is also removed. This expects the core's global lock is held.

func (*VolumePublicationCache) Get

func (vpc *VolumePublicationCache) Get(volume, node string) *models.VolumePublication

Get returns a copy of a value for an entry in the cache. Follow this with Set if changes to the returned value must exist in the cache.

func (*VolumePublicationCache) ListPublications

func (vpc *VolumePublicationCache) ListPublications() []*models.VolumePublication

ListPublications returns all publications. Callers should treat returned values as READ-ONLY. Follow this with SetMap if changes to the returned values must exist in the cache.

func (*VolumePublicationCache) ListPublicationsForNode

func (vpc *VolumePublicationCache) ListPublicationsForNode(node string) []*models.VolumePublication

ListPublicationsForNode returns all publications on a node. Callers should treat returned values as READ-ONLY. Follow this with SetMap if changes to the returned values must exist in the cache.

func (*VolumePublicationCache) ListPublicationsForVolume

func (vpc *VolumePublicationCache) ListPublicationsForVolume(volume string) []*models.VolumePublication

ListPublicationsForVolume returns all publications for a volume. Callers should treat returned values as READ-ONLY. Follow this with SetMap if changes to the returned values must exist in the cache.

func (*VolumePublicationCache) Map

Map returns a copy of the internal map. If a slice is needed, use List instead. Follow this with SetMap if changes to the returned values must exist in the cache.

func (*VolumePublicationCache) Set

func (vpc *VolumePublicationCache) Set(volume, node string, value *models.VolumePublication) error

Set adds or updates an entry in the cache. If no keys or value is supplied, it errors. This expects the core's global lock is held.

func (*VolumePublicationCache) SetMap

func (vpc *VolumePublicationCache) SetMap(data map[string]map[string]*models.VolumePublication)

SetMap sets the internal map to the supplied data. If no data is supplied, the internal map is initialized to an empty map. Any data present in the map before is lost and only the new data is stored. This expects the core's global lock is held.

func (*VolumePublicationCache) TryGet

func (vpc *VolumePublicationCache) TryGet(volume, node string) (*models.VolumePublication, bool)

TryGet attempts to retrieve an entry from the cache. If a value is found, a copy is returned. Callers should treat returned values as READ-ONLY. Follow this with Set if changes to the returned value must exist in the cache.

Jump to

Keyboard shortcuts

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