Documentation ¶
Index ¶
- func ExportModel(st StateExporter) ([]byte, error)
- func ImportModel(st *state.State, bytes []byte) (*state.Model, *state.State, error)
- func Precheck(backend PrecheckBackend) error
- func UploadBinaries(config UploadBinariesConfig) error
- type CharmUploader
- type PrecheckBackend
- type StateExporter
- type ToolsUploader
- type UploadBackend
- type UploadBinariesConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportModel ¶
func ExportModel(st StateExporter) ([]byte, error)
ExportModel creates a description.Model representation of the active model for StateExporter (typically a *state.State), and returns the serialized version. It provides the symmetric functionality to ImportModel.
func ImportModel ¶
ImportModel deserializes a model description from the bytes, transforms the model config based on information from the controller model, and then imports that as a new database model.
func Precheck ¶
func Precheck(backend PrecheckBackend) error
Precheck checks the database state to make sure that the preconditions for model migration are met.
func UploadBinaries ¶
func UploadBinaries(config UploadBinariesConfig) error
UploadBinaries will send binaries stored in the source blobstore to the target controller.
Types ¶
type CharmUploader ¶
type CharmUploader interface {
UploadCharm(*charm.URL, io.ReadSeeker) (*charm.URL, error)
}
CharmUploader defines a simple single method interface that is used to upload a charm to the target controller
type PrecheckBackend ¶
PrecheckBackend is implemented by *state.State but defined as an interface for easier testing.
type StateExporter ¶
type StateExporter interface { // Export generates an abstract representation of a model. Export() (description.Model, error) }
StateExporter describes interface on state required to export a model.
type ToolsUploader ¶
type ToolsUploader interface {
UploadTools(io.ReadSeeker, version.Binary, ...string) (tools.List, error)
}
ToolsUploader defines a simple single method interface that is used to upload tools to the target controller
type UploadBackend ¶
type UploadBackend interface { Charm(*charm.URL) (*state.Charm, error) ModelUUID() string MongoSession() *mgo.Session ToolsStorage() (binarystorage.StorageCloser, error) }
UploadBackend define the methods on *state.State that are needed for uploading the tools and charms from the current controller to a different controller.
type UploadBinariesConfig ¶
type UploadBinariesConfig struct { State UploadBackend Model description.Model Target api.Connection GetCharmUploader func(api.Connection) CharmUploader GetToolsUploader func(api.Connection) ToolsUploader GetStateStorage func(UploadBackend) storage.Storage GetCharmStoragePath func(UploadBackend, *charm.URL) (string, error) }
UploadBinariesConfig provides all the configuration that the UploadBinaries function needs to operate. The functions are configurable for testing purposes. To construct the config with the default functions, use `NewUploadBinariesConfig`.
func NewUploadBinariesConfig ¶
func NewUploadBinariesConfig(backend UploadBackend, model description.Model, target api.Connection) UploadBinariesConfig
NewUploadBinariesConfig constructs a `UploadBinariesConfig` with the default functions to get the uploaders for the target api connection, and functions used to get the charm data out of the database.
func (*UploadBinariesConfig) Validate ¶
func (c *UploadBinariesConfig) Validate() error
Validate makes sure that all the config values are non-nil.