Documentation
¶
Index ¶
- type NodeCache
- type VolumePublicationCache
- func (vpc *VolumePublicationCache) Clear()
- func (vpc *VolumePublicationCache) Delete(volume, node string) error
- func (vpc *VolumePublicationCache) Get(volume, node string) *models.VolumePublication
- func (vpc *VolumePublicationCache) ListPublications() []*models.VolumePublication
- func (vpc *VolumePublicationCache) ListPublicationsForNode(node string) []*models.VolumePublication
- func (vpc *VolumePublicationCache) ListPublicationsForVolume(volume string) []*models.VolumePublication
- func (vpc *VolumePublicationCache) Map() map[string]map[string]*models.VolumePublication
- func (vpc *VolumePublicationCache) Set(volume, node string, value *models.VolumePublication) error
- func (vpc *VolumePublicationCache) SetMap(data map[string]map[string]*models.VolumePublication)
- func (vpc *VolumePublicationCache) TryGet(volume, node string) (*models.VolumePublication, bool)
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 ¶
Delete removes the node from cache. Does nothing if node does not exist. Delete 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 ¶
func (vpc *VolumePublicationCache) Map() map[string]map[string]*models.VolumePublication
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.