registry

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrUnknownProvider is a sentinel error type returned if a client requests
	// an unknown indexer from the registry.
	ErrUnknownProvider = thingfulx.Error("thingfulx: unknown data provider")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Registry is a threadsafe data structure for holding instantiated thingfulx.Indexers, and returning them to a caller.

func NewRegistry

func NewRegistry() *Registry

NewRegistry is a constructor function that returns a Registry ready for use.

func (*Registry) GetIndexer

func (r *Registry) GetIndexer(providerUID string) (thingfulx.Indexer, error)

GetIndexer attempts to return the indexer for the specified provider UID.

func (*Registry) GetIndexers added in v0.8.2

func (r *Registry) GetIndexers() []thingfulx.Indexer

GetIndexers returns a list of the registered Indexers in the registry

func (*Registry) MustRegister

func (r *Registry) MustRegister(builder func() (thingfulx.Indexer, error))

MustRegister wraps our Register function but panics on any error as we cannot proceed.

func (*Registry) Register

func (r *Registry) Register(builder func() (thingfulx.Indexer, error)) error

Register is a function that takes as input a function that is capable of contructing a new indexer instance. It then instantiates the indexer returning any error, but should the operation succeed the indexer is saved into a registry for later use.

Jump to

Keyboard shortcuts

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