providertracker

package
v0.0.0-...-942e5e7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProviderRunner

func ProviderRunner[T any](providerFactory ProviderFactory, namespace string) func(context.Context) (T, error)

ProviderRunner returns the ProviderGetter function for a given generic type. If the returned provider is not of the expected type, a not supported error will be returned.

Types

type Provider

type Provider interface {
	// InstancePrechecker provides a means of "prechecking" placement
	// arguments before recording them in state.
	environs.InstancePrechecker

	// BootstrapEnviron defines methods for bootstrapping a controller.
	environs.BootstrapEnviron

	// ResourceAdopter defines methods for adopting resources.
	environs.ResourceAdopter
}

Provider in the intersection of a environs.Environ and a caas.Broker.

We ideally don't want to import the environs package here, but I've not sure how to avoid it.

type ProviderFactory

type ProviderFactory interface {
	// ProviderForModel returns the encapsulated provider for a given model
	// namespace. It will continue to be updated in the background for as long
	// as the Worker continues to run. If the worker is not a singular worker,
	// then an error will be returned.
	ProviderForModel(ctx context.Context, namespace string) (Provider, error)
}

ProviderFactory is an interface that provides a way to get a provider for a given model namespace. It will continue to be updated in the background for as long as the Worker continues to run.

type ProviderGetter

type ProviderGetter[T any] func(ctx context.Context) (T, error)

ProviderGetter is a function that returns a provider for a given type. It's generic type any because it can return any type of provider, this should be used in conjunction with the ProviderRunner function.

Jump to

Keyboard shortcuts

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