module

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0, Apache-2.0 Imports: 1 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFilters

func AddFilters(c context.Context, filts ...Filter) context.Context

AddFilters adds RawInterface filters to the context.

func DefaultVersion

func DefaultVersion(c context.Context, module string) (string, error)

DefaultVersion returns the name of the default version for the specified module.

If module is the empty string, it means the default.

func List

func List(c context.Context) ([]string, error)

List lists the names of modules belonging to this application.

func NumInstances

func NumInstances(c context.Context, module, version string) (int, error)

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

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

func SetFactory(c context.Context, gif Factory) context.Context

SetFactory sets the function to produce RawInterface instances, as returned by the Get method.

func SetNumInstances

func SetNumInstances(c context.Context, module, version string, instances int) error

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

func Start(c context.Context, module, version string) error

Start starts the specified module/version.

If module or version is the empty string, it means the default.

func Stop

func Stop(c context.Context, module, version string) error

Stop stops the specified module/version.

If module or version is the empty string, it means the default.

func Versions

func Versions(c context.Context, module string) ([]string, error)

Versions returns the names of versions for the specified module.

If module 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

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

Raw gets the RawInterface implementation from context.

Jump to

Keyboard shortcuts

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