Documentation ¶
Overview ¶
Package instancemgmt provides utilities for managing plugin instances.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedInstance ¶
type CachedInstance struct { PluginContext backend.PluginContext // contains filtered or unexported fields }
CachedInstance a cached Instance.
type InstanceCallbackFunc ¶
type InstanceCallbackFunc interface{}
InstanceCallbackFunc defines the callback function of the InstanceManager.Do method. The argument provided will of type Instance.
type InstanceDisposer ¶
type InstanceDisposer interface {
Dispose()
}
InstanceDisposer is implemented by an Instance that has a Dispose method, which defines that the instance is disposable.
InstanceManager will call the Dispose method before an Instance is replaced with a new Instance. This allows an Instance to clean up resources in use, if any.
type InstanceManager ¶
type InstanceManager interface { // Get returns an Instance. // // If Instance is cached and not updated it's returned. If Instance is not cached or // updated, a new Instance is created and cached before returned. Get(pluginContext backend.PluginContext) (Instance, error) // Do provides an Instance as argument to fn. // // If Instance is cached and not updated provides as argument to fn. If Instance is not cached or // updated, a new Instance is created and cached before provided as argument to fn. Do(pluginContext backend.PluginContext, fn InstanceCallbackFunc) error }
InstanceManager manages the lifecycle of instances.
type InstanceProvider ¶
type InstanceProvider interface { // GetKey returns a cache key to be used for caching an Instance. GetKey(pluginContext backend.PluginContext) (interface{}, error) // NeedsUpdate returns whether a cached Instance have been updated. NeedsUpdate(pluginContext backend.PluginContext, cachedInstance CachedInstance) bool // NewInstance creates a new Instance. NewInstance(pluginContext backend.PluginContext) (Instance, error) }
InstanceProvider defines an instance provider, providing instances.