Documentation ¶
Index ¶
- func AddFilters(c context.Context, filts ...Filter) context.Context
- func DefaultVersion(c context.Context, module string) (string, error)
- func List(c context.Context) ([]string, error)
- func NumInstances(c context.Context, module, version string) (int, error)
- func Set(c context.Context, gi RawInterface) context.Context
- func SetFactory(c context.Context, gif Factory) context.Context
- func SetNumInstances(c context.Context, module, version string, instances int) error
- func Start(c context.Context, module, version string) error
- func Stop(c context.Context, module, version string) error
- func Versions(c context.Context, module string) ([]string, error)
- type Factory
- type Filter
- type RawInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFilters ¶
AddFilters adds RawInterface filters to the context.
func DefaultVersion ¶
DefaultVersion returns the name of the default version for the specified module.
If module is the empty string, it means the default.
func NumInstances ¶
NumInstances returns the number of instances servicing the specified module/version.
If module or version is the empty string, it means the default.
func Set ¶
func Set(c context.Context, gi RawInterface) context.Context
Set sets the current RawInterface object in the context. Useful for testing with a quick mock. This is just a shorthand SetFactory invocation to set a factory which always returns the same object.
func SetFactory ¶
SetFactory sets the function to produce RawInterface instances, as returned by the Get method.
func SetNumInstances ¶
SetNumInstances sets the number of instances of a given module/version.
If module or version is the empty string, it means the default.
func Start ¶
Start starts the specified module/version.
If module or version is the empty string, it means the default.
Types ¶
type Factory ¶
type Factory func(context.Context) RawInterface
Factory is the function signature for factory methods compatible with SetFactory.
type Filter ¶
type Filter func(context.Context, RawInterface) RawInterface
Filter is the function signature for a filter module implementation. It gets the current module implementation, and returns a new module implementation backed by the one passed in.
type RawInterface ¶
type RawInterface interface { List() ([]string, error) NumInstances(module, version string) (int, error) SetNumInstances(module, version string, instances int) error Versions(module string) ([]string, error) DefaultVersion(module string) (string, error) Start(module, version string) error Stop(module, version string) error }
RawInterface is the interface for all of the package methods which normally would be in the 'module' package.
func Raw ¶
func Raw(c context.Context) RawInterface
Raw gets the RawInterface implementation from context.