Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AtomicRegistry ¶
func NewAtomicRegistry ¶
func NewAtomicRegistry(initialValue *Registry) AtomicRegistry
NewAtomicRegistry creates a new envelope to hold a Registry object.
func (*AtomicRegistry) Load ¶
func (a *AtomicRegistry) Load() *Registry
Load loads the stored Registry or nil if non exists
func (*AtomicRegistry) Store ¶
func (a *AtomicRegistry) Store(r *Registry)
Store stores the Registry to be retrieved later.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a generic plugin registrar for dependency injection.
func (*Registry) Get ¶
Get retrieves a registered implementation for the ID. If one doesn't exist, it returns the default implementation. If the id isn't found, it returns nil.
func (*Registry) Register ¶
Register registers a new implementation for the pluginID. Only one plugin is allowed to be registered for a given ID.
func (*Registry) RegisterDefault ¶
RegisterDefault registers a new implementation for the pluginID. This is the implementation that will be used if no other plugin is registered for the ID.