Documentation ¶
Overview ¶
package registry provides ways for plugins to add rothko entities.
Index ¶
- func NewDatabase(ctx context.Context, name string, config interface{}) (database.DB, error)
- func NewDistribution(ctx context.Context, name string, config interface{}) (dist.Params, error)
- func NewListener(ctx context.Context, name string, config interface{}) (listener.Listener, error)
- func RegisterDatabase(name string, maker DatabaseMaker)
- func RegisterDistribution(name string, maker DistributionMaker)
- func RegisterListener(name string, maker ListenerMaker)
- type DatabaseMaker
- type DatabaseMakerFunc
- type DistributionMaker
- type DistributionMakerFunc
- type ListenerMaker
- type ListenerMakerFunc
- type Registry
- func (r *Registry) NewDatabase(ctx context.Context, name string, config interface{}) (database.DB, error)
- func (r *Registry) NewDistribution(ctx context.Context, name string, config interface{}) (dist.Params, error)
- func (r *Registry) NewListener(ctx context.Context, name string, config interface{}) (listener.Listener, error)
- func (r *Registry) RegisterDatabase(name string, maker DatabaseMaker)
- func (r *Registry) RegisterDistribution(name string, maker DistributionMaker)
- func (r *Registry) RegisterListener(name string, maker ListenerMaker)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatabase ¶
NewDatabase constructs a Database using the DatabaseMaker registered under the name in the Default registry. It returns an error if there has been no such registration.
func NewDistribution ¶
NewDistribution constructs a Distribution using the DistributionMaker registered under the name in the Default registry. It returns an error if there has been no such registration.
func NewListener ¶
NewListener constructs a Listener using the ListenerMaker registered under the name in the Default registry. It returns an error if there has been no such registration.
func RegisterDatabase ¶
func RegisterDatabase(name string, maker DatabaseMaker)
RegisterDatabase registers the DatabaseMaker as the provided name in the Default registry. It overwrites any previous calls for the same name.
func RegisterDistribution ¶
func RegisterDistribution(name string, maker DistributionMaker)
RegisterDistribution registers the DistributionMaker as the provided name in the Default registry. It overwrites any previous calls for the same name.
func RegisterListener ¶
func RegisterListener(name string, maker ListenerMaker)
RegisterListener registers the ListenerMaker as the provided name in the Default registry. It overwrites any previous calls for the same name.
Types ¶
type DatabaseMaker ¶
DatabaseMaker constructs a listener from the provided config.
type DatabaseMakerFunc ¶
DatabaseMakerFunc is a function type that implements DatabaseMaker.
type DistributionMaker ¶
type DistributionMaker interface {
New(ctx context.Context, config interface{}) (dist.Params, error)
}
DistributionMaker constructs a listener from the provided config.
type DistributionMakerFunc ¶
DistributionMakerFunc is a function type that implements DistributionMaker.
type ListenerMaker ¶
type ListenerMaker interface {
New(ctx context.Context, config interface{}) (listener.Listener, error)
}
ListenerMaker constructs a listener from the provided config.
type ListenerMakerFunc ¶
ListenerMakerFunc is a function type that implements ListenerMaker.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry keeps track of a set of Makers by name.
var Default Registry
Default is the default registry that the Register calls insert into.
func (*Registry) NewDatabase ¶
func (r *Registry) NewDatabase(ctx context.Context, name string, config interface{}) (database.DB, error)
NewDatabase constructs a Database using the DatabaseMaker registered under the name. It returns an error if there has been no such registration.
func (*Registry) NewDistribution ¶
func (r *Registry) NewDistribution(ctx context.Context, name string, config interface{}) (dist.Params, error)
NewDistribution constructs a Distribution using the DistributionMaker registered under the name. It returns an error if there has been no such registration.
func (*Registry) NewListener ¶
func (r *Registry) NewListener(ctx context.Context, name string, config interface{}) (listener.Listener, error)
NewListener constructs a Listener using the ListenerMaker registered under the name. It returns an error if there has been no such registration.
func (*Registry) RegisterDatabase ¶
func (r *Registry) RegisterDatabase(name string, maker DatabaseMaker)
RegisterDatabase registers the DatabaseMaker under the given name. It overwrites any previous calls for the same name.
func (*Registry) RegisterDistribution ¶
func (r *Registry) RegisterDistribution(name string, maker DistributionMaker)
RegisterDistribution registers the DistributionMaker under the given name. It overwrites any previous calls for the same name.
func (*Registry) RegisterListener ¶
func (r *Registry) RegisterListener(name string, maker ListenerMaker)
RegisterListener registers the ListenerMaker under the given name. It overwrites any previous calls for the same name.