Documentation ¶
Index ¶
- func GetControllerConfig(ctx context.Context, controllerConfigService ControllerConfigService) (controller.Config, error)
- func Manifold(config ManifoldConfig) dependency.Manifold
- func New(config Config) (worker.Worker, error)
- type Config
- type Controller
- type ControllerConfigGetter
- type ControllerConfigService
- type GetControllerConfigFunc
- type GetProviderServicesGetterFunc
- type ManifoldConfig
- type MetricSink
- type Model
- type ModelLogger
- type ModelMetrics
- type ModelWatcher
- type NewModelConfig
- type NewModelWorkerFunc
- type ProviderCloudService
- type ProviderConfigService
- type ProviderCredentialService
- type ProviderModelService
- type ProviderServices
- type ProviderServicesGetter
- type RecordLogger
- type StatePoolController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetControllerConfig ¶
func GetControllerConfig(ctx context.Context, controllerConfigService ControllerConfigService) (controller.Config, error)
GetControllerConfig returns the controller config from the given service.
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold returns a dependency.Manifold that will run a model worker manager.
Types ¶
type Config ¶
type Config struct { Authority pki.Authority Logger corelogger.Logger MachineID string ModelWatcher ModelWatcher ModelMetrics ModelMetrics Mux *apiserverhttp.Mux Controller Controller NewModelWorker NewModelWorkerFunc ErrorDelay time.Duration LogSink corelogger.ModelLogger ProviderServicesGetter ProviderServicesGetter DomainServicesGetter services.DomainServicesGetter GetControllerConfig GetControllerConfigFunc }
Config holds the dependencies and configuration necessary to run a model worker manager.
type Controller ¶
Controller provides an interface for getting models by UUID, and other details needed to pass into the function to start workers for a model. Once a model is no longer required, the returned function must be called to dispose of the model.
type ControllerConfigGetter ¶
type ControllerConfigGetter interface {
ControllerConfig(context.Context) (controller.Config, error)
}
ControllerConfigGetter is an interface that returns the controller config.
type ControllerConfigService ¶
type ControllerConfigService interface {
ControllerConfig(ctx context.Context) (controller.Config, error)
}
ControllerConfigService is an interface that returns the controller config.
type GetControllerConfigFunc ¶
type GetControllerConfigFunc func(ctx context.Context, controllerConfigService ControllerConfigService) (controller.Config, error)
GetControllerConfigFunc is a function that returns the controller config, from the given service.
type GetProviderServicesGetterFunc ¶
type GetProviderServicesGetterFunc func(getter dependency.Getter, name string) (ProviderServicesGetter, error)
GetProviderServicesGetterFunc returns a ProviderServicesGetter from the given dependency.Getter.
type ManifoldConfig ¶
type ManifoldConfig struct { // AgentName is the name of the agent.Agent dependency. AgentName string // AuthorityName is the name of the pki.Authority dependency. AuthorityName string // StateName is the name of the workerstate.StateTracker dependency. // Deprecated: Migration to domain services. StateName string // DomainServicesName is used to get the controller domain services // dependency. DomainServicesName string // ProviderServiceFactoriesName is used to get the provider domain services // getter dependency. This exposes a provider domain services for each // model upon request. ProviderServiceFactoriesName string // LogSinkName is the name of the corelogger.ModelLogger dependency. LogSinkName string // GetProviderServicesGetter is used to get the provider service // factory getter from the dependency engine. This makes testing a lot // simpler, as we can expose the interface directly, without the // intermediary type. GetProviderServicesGetter GetProviderServicesGetterFunc // GetControllerConfig is used to get the controller config from the // controller service. GetControllerConfig GetControllerConfigFunc // NewWorker is the function that creates the worker. NewWorker func(Config) (worker.Worker, error) // NewModelWorker is the function that creates the model worker. NewModelWorker NewModelWorkerFunc // ModelMetrics is the metrics for the model worker. ModelMetrics ModelMetrics // Logger is the logger for the worker. Logger logger.Logger }
ManifoldConfig holds the information necessary to run a model worker manager in a dependency.Engine.
func (ManifoldConfig) Validate ¶
func (config ManifoldConfig) Validate() error
Validate validates the manifold configuration.
type MetricSink ¶
type MetricSink = agentengine.MetricSink
MetricSink describes a way to unregister a model metrics collector. This ensures that we correctly tidy up after the removal of a model.
type Model ¶
type Model interface { MigrationMode() state.MigrationMode Type() state.ModelType Name() string Owner() names.UserTag }
Model represents a model.
type ModelLogger ¶
type ModelLogger interface {
loggo.Writer
Close() error
}
ModelLogger is a database backed loggo Writer.
type ModelMetrics ¶
type ModelMetrics interface {
ForModel(names.ModelTag) MetricSink
}
ModelMetrics defines a way to create metrics for a model.
type ModelWatcher ¶
type ModelWatcher interface {
WatchModels() state.StringsWatcher
}
ModelWatcher provides an interface for watching the additiona and removal of models.
type NewModelConfig ¶
type NewModelConfig struct { Authority pki.Authority ModelName string ModelOwner string ModelUUID string ModelType state.ModelType ModelLogger ModelLogger ModelMetrics MetricSink ControllerConfig controller.Config ProviderServicesGetter ProviderServicesGetter DomainServices services.DomainServices }
NewModelConfig holds the information required by the NewModelWorkerFunc to start the workers for the specified model
type NewModelWorkerFunc ¶
type NewModelWorkerFunc func(config NewModelConfig) (worker.Worker, error)
NewModelWorkerFunc should return a worker responsible for running all a model's required workers; and for returning nil when there's no more model to manage.
type ProviderCloudService ¶
type ProviderCloudService interface { // Cloud returns the named cloud. Cloud(ctx context.Context, name string) (*cloud.Cloud, error) // WatchCloud returns a watcher that observes changes to the specified cloud. WatchCloud(ctx context.Context, name string) (watcher.NotifyWatcher, error) }
ProviderCloudService represents the cloud service provided by the provider.
type ProviderConfigService ¶
type ProviderConfigService interface { // ModelConfig returns the model configuration for the given tag. ModelConfig(ctx context.Context) (*config.Config, error) // WatchModelConfig returns a watcher that observes changes to the specified // model configuration. Watch() (watcher.StringsWatcher, error) }
ProviderConfigService represents the config service provided by the provider.
type ProviderCredentialService ¶
type ProviderCredentialService interface { // CloudCredential returns the cloud credential for the given tag. CloudCredential(ctx context.Context, key credential.Key) (cloud.Credential, error) // WatchCredential returns a watcher that observes changes to the specified // credential. WatchCredential(ctx context.Context, key credential.Key) (watcher.NotifyWatcher, error) }
ProviderCredentialService represents the credential service provided by the provider.
type ProviderModelService ¶
type ProviderModelService interface { // Model returns the read-only default model. Model(ctx context.Context) (coremodel.ReadOnlyModel, error) }
ProviderModelService represents the model service provided by the provider.
type ProviderServices ¶
type ProviderServices interface { // Model returns the provider model service. Model() ProviderModelService // Cloud returns the cloud service. Cloud() ProviderCloudService // Config returns the config service. Config() ProviderConfigService // Credential returns the credential service. Credential() ProviderCredentialService }
ProviderServices provides access to the services required by the provider.
type ProviderServicesGetter ¶
type ProviderServicesGetter interface { // ServicesForModel returns a ProviderServices for the given model. ServicesForModel(modelUUID string) ProviderServices }
ProviderServicesGetter represents a way to get a ProviderServices for a given model.
func GetProviderServicesGetter ¶
func GetProviderServicesGetter(getter dependency.Getter, name string) (ProviderServicesGetter, error)
GetProviderServicesGetter returns a ProviderServicesGetter from the given dependency.Getter.
type RecordLogger ¶
type RecordLogger interface { io.Closer // Log writes the given log records to the logger's storage. Log([]corelogger.LogRecord) error }
RecordLogger writes logs to backing store.
type StatePoolController ¶
StatePoolController implements Controller in terms of a *state.StatePool.