pluginstatusmap

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package pluginstatusmap implements specialization of idxmap used to store plugin status by plugin name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexPluginStatus

func IndexPluginStatus(data interface{}) map[string][]string

IndexPluginStatus creates indexes for plugin states and records the state passed as untyped data.

Types

type PluginStatusEvent

type PluginStatusEvent struct {
	idxmap.NamedMappingEvent
	Value *status.PluginStatus
}

PluginStatusEvent represents an item sent through the watch channel in PluginStatusMap.WatchNameToIdx(). In contrast to NameToIdxDto it contains a typed Value.

type PluginStatusIdxMap

type PluginStatusIdxMap interface {
	// GetMapping returns internal read-only mapping with Value
	// of type interface{}.
	GetMapping() idxmap.NamedMapping

	// GetValue looks up previously stored status by plugin name in the mapping.
	GetValue(pluginName string) (data *status.PluginStatus, exists bool)

	// WatchNameToIdx allows to subscribe for watching changes in pluginStatusMap
	// mapping.
	WatchNameToIdx(subscriber core.PluginName, pluginChannel chan PluginStatusEvent)
}

PluginStatusIdxMap provides map of plugin names to plugin status. Other plugins can watch changes to this map.

type PluginStatusIdxMapRW

type PluginStatusIdxMapRW interface {
	PluginStatusIdxMap

	// RegisterName adds new item into name-to-index mapping.
	Put(pluginName string, pluginStatus *status.PluginStatus)

	// UnregisterName removes an item identified by name from mapping
	Delete(pluginName string) (data *status.PluginStatus, exists bool)
}

PluginStatusIdxMapRW exposes not only PluginStatusIdxMap but also write methods.

func NewPluginStatusMap

func NewPluginStatusMap(owner core.PluginName) PluginStatusIdxMapRW

NewPluginStatusMap is a constructor for PluginStatusIdxMapRW.

Jump to

Keyboard shortcuts

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