registry

package
v0.0.0-...-0ce9163 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

package registry

import "github.com/vivint/rothko/registry"

package registry provides ways for plugins to add rothko entities.

Usage

func NewDatabase
func NewDatabase(ctx context.Context, name string, config interface{}) (
	database.DB, error)

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
func NewDistribution(ctx context.Context, name string, config interface{}) (
	dist.Params, error)

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
func NewListener(ctx context.Context, name string, config interface{}) (
	listener.Listener, error)

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.

type DatabaseMaker
type DatabaseMaker interface {
	New(ctx context.Context, config interface{}) (database.DB, error)
}

DatabaseMaker constructs a listener from the provided config.

type DatabaseMakerFunc
type DatabaseMakerFunc func(context.Context, interface{}) (database.DB, error)

DatabaseMakerFunc is a function type that implements DatabaseMaker.

func (DatabaseMakerFunc) New
func (fn DatabaseMakerFunc) New(ctx context.Context, config interface{}) (
	database.DB, error)

New calls the DatabaseMakerFunc.

type DistributionMaker
type DistributionMaker interface {
	New(ctx context.Context, config interface{}) (dist.Params, error)
}

DistributionMaker constructs a listener from the provided config.

type DistributionMakerFunc
type DistributionMakerFunc func(context.Context, interface{}) (
	dist.Params, error)

DistributionMakerFunc is a function type that implements DistributionMaker.

func (DistributionMakerFunc) New
func (fn DistributionMakerFunc) New(ctx context.Context, config interface{}) (
	dist.Params, error)

New calls the DistributionMakerFunc.

type ListenerMaker
type ListenerMaker interface {
	New(ctx context.Context, config interface{}) (listener.Listener, error)
}

ListenerMaker constructs a listener from the provided config.

type ListenerMakerFunc
type ListenerMakerFunc func(context.Context, interface{}) (
	listener.Listener, error)

ListenerMakerFunc is a function type that implements ListenerMaker.

func (ListenerMakerFunc) New
func (fn ListenerMakerFunc) New(ctx context.Context, config interface{}) (
	listener.Listener, error)

New calls the ListenerMakerFunc.

type Registry
type Registry struct {
}

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.

Documentation

Overview

package registry provides ways for plugins to add rothko entities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatabase

func NewDatabase(ctx context.Context, name string, config interface{}) (
	database.DB, error)

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

func NewDistribution(ctx context.Context, name string, config interface{}) (
	dist.Params, error)

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

func NewListener(ctx context.Context, name string, config interface{}) (
	listener.Listener, error)

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

type DatabaseMaker interface {
	New(ctx context.Context, config interface{}) (database.DB, error)
}

DatabaseMaker constructs a listener from the provided config.

type DatabaseMakerFunc

type DatabaseMakerFunc func(context.Context, interface{}) (database.DB, error)

DatabaseMakerFunc is a function type that implements DatabaseMaker.

func (DatabaseMakerFunc) New

func (fn DatabaseMakerFunc) New(ctx context.Context, config interface{}) (
	database.DB, error)

New calls the DatabaseMakerFunc.

type DistributionMaker

type DistributionMaker interface {
	New(ctx context.Context, config interface{}) (dist.Params, error)
}

DistributionMaker constructs a listener from the provided config.

type DistributionMakerFunc

type DistributionMakerFunc func(context.Context, interface{}) (
	dist.Params, error)

DistributionMakerFunc is a function type that implements DistributionMaker.

func (DistributionMakerFunc) New

func (fn DistributionMakerFunc) New(ctx context.Context, config interface{}) (
	dist.Params, error)

New calls the DistributionMakerFunc.

type ListenerMaker

type ListenerMaker interface {
	New(ctx context.Context, config interface{}) (listener.Listener, error)
}

ListenerMaker constructs a listener from the provided config.

type ListenerMakerFunc

type ListenerMakerFunc func(context.Context, interface{}) (
	listener.Listener, error)

ListenerMakerFunc is a function type that implements ListenerMaker.

func (ListenerMakerFunc) New

func (fn ListenerMakerFunc) New(ctx context.Context, config interface{}) (
	listener.Listener, error)

New calls the ListenerMakerFunc.

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.

Jump to

Keyboard shortcuts

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