Documentation ¶
Overview ¶
Package registrar implements a variant of the registration pattern.
Index ¶
- type Driver
- type Drivers
- type Feature
- type Features
- type Option
- type Registry
- func (r Registry) FilterForCompatible(ctx context.Context) Drivers
- func (r Registry) For(driver string) Drivers
- func (r Registry) GetDriverInterfaces() []interface{}
- func (r Registry) PreferDriver(drivers ...string) Drivers
- func (r Registry) PreferProtocol(protocols ...string) Drivers
- func (r *Registry) Register(name, protocol string, features Features, metadata interface{}, ...)
- func (r Registry) Supports(features ...Feature) Drivers
- func (r Registry) Using(proto string) Drivers
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct { Name string Protocol string Features Features Metadata interface{} DriverInterface interface{} }
Driver holds the info about a driver.
type Registry ¶
Registry holds the registered drivers.
func NewRegistry ¶
NewRegistry returns a new Driver registry.
func (Registry) FilterForCompatible ¶
FilterForCompatible updates the driver registry with only compatible implementations. compatible implementations are determined by running the Compatible method of the Verifier interface. registered drivers must implement the Verifier interface for this. Order is preserved.
func (Registry) GetDriverInterfaces ¶
func (r Registry) GetDriverInterfaces() []interface{}
GetDriverInterfaces returns a slice of just the generic driver interfaces.
func (Registry) PreferDriver ¶ added in v0.4.0
PreferDriver will reorder the registry by moving preferred drivers to the start.
func (Registry) PreferProtocol ¶
PreferProtocol does the actual work of moving preferred protocols to the start of the driver registry.
func (*Registry) Register ¶
func (r *Registry) Register(name, protocol string, features Features, metadata interface{}, driverInterface interface{})
Register will add a driver a Driver registry.