modelgeneration

package
v0.0.0-...-6dcaeb9 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(registry facade.FacadeRegistry)

Register is called to expose a package of facades onto a given registry.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API is the concrete implementation of the API endpoint.

func NewModelGenerationAPI

func NewModelGenerationAPI(
	st State,
	authorizer facade.Authorizer,
	m Model,
	mc ModelCache,
) (*API, error)

NewModelGenerationAPI creates a new API endpoint for dealing with model generations.

func (*API) AbortBranch

func (api *API) AbortBranch(arg params.BranchArg) (params.ErrorResult, error)

AbortBranch aborts the input branch, marking it complete. However no changes are made applicable to the whole model. No units may be assigned to the branch when aborting.

func (*API) AddBranch

func (api *API) AddBranch(arg params.BranchArg) (params.ErrorResult, error)

AddBranch adds a new branch with the input name to the model.

func (*API) BranchInfo

func (api *API) BranchInfo(
	args params.BranchInfoArgs) (params.BranchResults, error)

BranchInfo will return details of branch identified by the input argument, including units on the branch and the configuration disjoint with the master generation. An error is returned if no in-flight branch matching in input is found.

func (*API) CommitBranch

func (api *API) CommitBranch(arg params.BranchArg) (params.IntResult, error)

CommitBranch commits the input branch, making its changes applicable to the whole model and marking it complete.

func (*API) HasActiveBranch

func (api *API) HasActiveBranch(arg params.BranchArg) (params.BoolResult, error)

HasActiveBranch returns a true result if the input model has an "in-flight" branch matching the input name.

func (*API) ListCommits

func (api *API) ListCommits() (params.BranchResults, error)

ListCommits will return the commits, hence only branches with generation_id higher than 0

func (*API) ShowCommit

func (api *API) ShowCommit(arg params.GenerationId) (params.GenerationResult, error)

ShowCommit will return details a commit given by its generationId An error is returned if either no branch can be found corresponding to the generation id. Or the generation id given is below 1.

func (*API) TrackBranch

func (api *API) TrackBranch(arg params.BranchTrackArg) (params.ErrorResults, error)

TrackBranch marks the input units and/or applications as tracking the input branch, causing them to realise changes made under that branch.

type Application

type Application interface {
	UnitNames() ([]string, error)

	// DefaultCharmConfig is the only abstraction in these shims.
	// It saves us having to shim out Charm as well.
	DefaultCharmConfig() (charm.Settings, error)
}

Application describes application state used by the model generation API.

type Generation

type Generation interface {
	BranchName() string
	Created() int64
	CreatedBy() string
	Completed() int64
	CompletedBy() string
	AssignAllUnits(string) error
	AssignUnits(string, int) error
	AssignUnit(string) error
	AssignedUnits() map[string][]string
	Commit(string) (int, error)
	Abort(string) error
	Config() map[string]settings.ItemChanges
	GenerationId() int
}

Generation defines the methods used by a generation.

type Model

type Model interface {
	ModelTag() names.ModelTag
	AddBranch(string, string) error
	Branch(string) (Generation, error)
	Branches() ([]Generation, error)
	Generation(int) (Generation, error)
	Generations() ([]Generation, error)
}

Model describes model state used by the model generation API.

type ModelCache

type ModelCache interface {
	Branch(string) (cache.Branch, error)
}

ModelCache describes a cached model used by the model generation API.

type State

type State interface {
	ControllerTag() names.ControllerTag
	Model() (Model, error)
	Application(string) (Application, error)
}

State represents the state of a model required by the model generation API.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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