application

package
v0.0.0-...-1592773 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0 Imports: 12 Imported by: 6

Documentation

Overview

Package application provides the domain types for an application. The application domain is the primary domain for creation and handling of an application.

The charm is the stored representation of the application. The application is the instance manifest of the charm and the unit is the running instance of the application.

Charm types are stored in the application/charm package, to ensure that the charm is handled correctly and that the charm is correctly represented in the domain.

A resource is a stored representation of a charm's resource. There are 3 types of resources after deploy: an application resource, a unit resource and a repository resource. Once deployed, resources can be refreshed independently from a charm. Thus they will have relations to applications but not a specific charm revision.

Resource types are stored in the application/resource package, to ensure that the resources is handled correctly and that the resource is correctly represented in the domain.

Index

Constants

View Source
const (
	// StorageDefaultBlockSourceKey is the key for the default block storage source.
	StorageDefaultBlockSourceKey = "storage-default-block-source"

	// StorageDefaultFilesystemSourceKey is the key for the default filesystem storage source.
	StorageDefaultFilesystemSourceKey = "storage-default-filesystem-source"
)

TODO(dqlite) - we don't want to reference environs/config here but need a place for config key names.

View Source
const (
	// HashAlgorithmSHA256 is the sha256 hash algorithm.
	// Currently it's the only one.
	HashAlgorithmSHA256 = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddApplicationArg

type AddApplicationArg struct {
	// Charm is the charm to add to the application. This is required to
	// be able to add the application.
	Charm domaincharm.Charm
	// CharmDownloadInfo contains the download information for the charm.
	// This information is used to download the charm from the charm store if
	// required.
	CharmDownloadInfo *domaincharm.DownloadInfo
	// Platform contains the platform information for the application. The
	// operating system and architecture.
	Platform Platform
	// Channel contains the channel information for the application. The track,
	// risk and branch of the charm when it was downloaded from the charm store.
	Channel *Channel
	// Resources defines the list of resources to add to an application.
	// They should match all the resources defined in the Charm.
	Resources []AddApplicationResourceArg
	// PendingResources are the uuids of resources added before the
	// application is created.
	PendingResources []resource.UUID
	// Storage defines the list of storage directives to add to an application.
	// The Name values should match the storage defined in the Charm.
	Storage []AddApplicationStorageArg
	// Config contains the configuration for the application, overlaid on top
	// of the charm's default configuration.
	Config map[string]ApplicationConfig
	// Settings contains the settings for the application. This includes the
	// trust setting.
	Settings ApplicationSettings
	// Scale contains the scale information for the application.
	Scale int
	// Status contains the status of the application.
	Status *StatusInfo[WorkloadStatusType]
}

AddApplicationArg contains parameters for saving an application to state.

type AddApplicationResourceArg

type AddApplicationResourceArg struct {
	Name     string
	Revision *int
	Origin   charmresource.Origin
}

AddApplicationResourceArg defines the arguments required to add a resource to an application.

type AddApplicationStorageArg

type AddApplicationStorageArg struct {
	Name           string
	PoolNameOrType string
	Size           uint64
	Count          uint64
}

AddApplicationStorageArg defines the arguments required to add storage to an application.

type AddUnitArg

type AddUnitArg struct {
	UnitName coreunit.Name
	UnitStatusArg
}

AddUnitArg contains parameters for adding a unit to state.

type ApplicationConfig

type ApplicationConfig struct {
	// Type dictates the type of the config value. The value is derived from
	// the charm config.
	Type  domaincharm.OptionType
	Value any
}

ApplicationConfig contains the configuration for the application config. This will include the charm config type.

type ApplicationSettings

type ApplicationSettings struct {
	Trust bool
}

ApplicationSettings contains the settings for an application.

type Architecture

type Architecture = architecture.Architecture

Architecture represents the architecture of a application charm.

type Channel

type Channel struct {
	Track  string
	Risk   ChannelRisk
	Branch string
}

Channel represents the channel of a application charm. Do not confuse this with a channel that is in the manifest file found in the charm package. They represent different concepts, yet hold the same data.

type ChannelRisk

type ChannelRisk string

ChannelRisk describes the type of risk in a current channel.

const (
	RiskStable    ChannelRisk = "stable"
	RiskCandidate ChannelRisk = "candidate"
	RiskBeta      ChannelRisk = "beta"
	RiskEdge      ChannelRisk = "edge"
)

type CharmDownloadInfo

type CharmDownloadInfo struct {
	CharmUUID    charm.ID
	Name         string
	SHA256       string
	DownloadInfo domaincharm.DownloadInfo
}

CharmDownloadInfo contains parameters for downloading a charm.

type CloudContainer

type CloudContainer struct {
	ProviderID string
	Address    *ContainerAddress
	Ports      *[]string
}

CloudContainer contains parameters for a unit's cloud container.

type CloudContainerParams

type CloudContainerParams struct {
	ProviderID    string
	Address       *network.SpaceAddress
	AddressOrigin *network.Origin
	Ports         *[]string
}

CloudContainerParams contains parameters for a unit cloud container.

type CloudContainerStatusType

type CloudContainerStatusType int

CloudContainerStatusType represents the status of a cloud container as recorded in the k8s_pod_status_value lookup table.

const (
	CloudContainerStatusWaiting CloudContainerStatusType = iota
	CloudContainerStatusBlocked
	CloudContainerStatusRunning
)

type CloudService

type CloudService struct {
	ProviderID string
	Address    *ServiceAddress
}

CloudService contains parameters for an application's cloud service.

type ContainerAddress

type ContainerAddress struct {
	Device      ContainerDevice
	Value       string
	AddressType ipaddress.AddressType
	Scope       ipaddress.Scope
	Origin      ipaddress.Origin
	ConfigType  ipaddress.ConfigType
}

ContainerAddress contains parameters for a cloud container address. Device is an attribute of address rather than cloud container since it's a placeholder used to tie the address to the cloud container and is only needed if the address exists.

type ContainerDevice

type ContainerDevice struct {
	Name              string
	DeviceTypeID      linklayerdevice.DeviceType
	VirtualPortTypeID linklayerdevice.VirtualPortType
}

ContainerDevice is the placeholder link layer device used to tie the cloud container IP address to the container.

type InsertUnitArg

type InsertUnitArg struct {
	UnitName       coreunit.Name
	CloudContainer *CloudContainer
	Password       *PasswordInfo
	UnitStatusArg
}

InsertUnitArg is used to insert a fully populated unit. Used by import and when registering a CAAS unit.

type OSType

type OSType int

OSType represents the type of an application's OS.

const (
	Ubuntu OSType = iota
)

type Origin

type Origin struct {
	ID       string
	Channel  Channel
	Platform Platform
	Revision int
}

Origin contains parameters for an application's origin.

type PasswordInfo

type PasswordInfo struct {
	PasswordHash  string
	HashAlgorithm int
}

PasswordInfo contains password parameters.

type Platform

type Platform struct {
	Channel      string
	OSType       OSType
	Architecture Architecture
}

Platform contains parameters for an application's platform.

type RegisterCAASUnitArg

type RegisterCAASUnitArg struct {
	UnitName     coreunit.Name
	PasswordHash string
	ProviderID   string
	Address      *string
	Ports        *[]string
	OrderedScale bool
	OrderedId    int
}

RegisterCAASUnitArg contains parameters for introducing a k8s unit representing a new pod to the model.

type ResolveCharmDownload

type ResolveCharmDownload struct {
	CharmUUID charm.ID
	SHA256    string
	SHA384    string
	Path      string
	Size      int64
}

ResolveCharmDownload contains parameters for resolving a charm download.

type ResolveControllerCharmDownload

type ResolveControllerCharmDownload struct {
	SHA256 string
	SHA384 string
	Path   string
	Size   int64
}

ResolveControllerCharmDownload contains parameters for resolving a charm download.

type ResolvedCharmDownload

type ResolvedCharmDownload struct {
	// Actions is the actions that the charm supports.
	// Deprecated: should be filled in by the charm store.
	Actions         domaincharm.Actions
	LXDProfile      []byte
	ObjectStoreUUID objectstore.UUID
	ArchivePath     string
}

ResolvedCharmDownload contains parameters for a resolved charm download.

type ResolvedControllerCharmDownload

type ResolvedControllerCharmDownload struct {
	Charm           internalcharm.Charm
	ArchivePath     string
	ObjectStoreUUID objectstore.UUID
}

ResolvedControllerCharmDownload contains parameters for a resolved controller charm download.

type RevisionUpdaterApplication

type RevisionUpdaterApplication struct {
	Name         string
	CharmLocator domaincharm.CharmLocator
	Origin       Origin
	NumUnits     int
}

RevisionUpdaterApplication is responsible for updating the revision of an application.

type ScaleState

type ScaleState struct {
	Scaling     bool
	Scale       int
	ScaleTarget int
}

ScaleState describes the scale status of a k8s application.

type ServiceAddress

type ServiceAddress struct {
	Value       string
	AddressType ipaddress.AddressType
	Scope       ipaddress.Scope
	Origin      ipaddress.Origin
	ConfigType  ipaddress.ConfigType
}

ServiceAddress contains parameters for a cloud service address. This may be from a load balancer, or cluster service etc.

type StatusID

StatusID represents the status of an entity.

type StatusInfo

type StatusInfo[T StatusID] struct {
	Status  T
	Message string
	Data    []byte
	Since   *time.Time
}

StatusInfo holds details about the status of an entity.

type UnitAgentStatusType

type UnitAgentStatusType int

UnitAgentStatusType represents the status of a unit agent as recorded in the unit_agent_status_value lookup table.

const (
	UnitAgentStatusAllocating UnitAgentStatusType = iota
	UnitAgentStatusExecuting
	UnitAgentStatusIdle
	UnitAgentStatusError
	UnitAgentStatusFailed
	UnitAgentStatusLost
	UnitAgentStatusRebooting
)

type UnitStatusArg

type UnitStatusArg struct {
	AgentStatus    *StatusInfo[UnitAgentStatusType]
	WorkloadStatus *StatusInfo[WorkloadStatusType]
}

UnitStatusArg contains parameters for updating a unit status in state.

type UnsetStatusType

type UnsetStatusType int

UnsetStatusType represents the status of an entity that has not been set.

const (
	UnsetStatus UnsetStatusType = iota
)

type UpdateCAASUnitParams

type UpdateCAASUnitParams struct {
	ProviderID           *string
	Address              *string
	Ports                *[]string
	AgentStatus          *StatusInfo[UnitAgentStatusType]
	WorkloadStatus       *StatusInfo[WorkloadStatusType]
	CloudContainerStatus *StatusInfo[CloudContainerStatusType]
}

UpdateCAASUnitParams contains parameters for updating a CAAS unit.

type WorkloadStatusType

type WorkloadStatusType int

WorkloadStatusType represents the status of a unit workload or application as recorded in the workload_status_value lookup table.

const (
	WorkloadStatusUnset WorkloadStatusType = iota
	WorkloadStatusUnknown
	WorkloadStatusMaintenance
	WorkloadStatusWaiting
	WorkloadStatusBlocked
	WorkloadStatusActive
	WorkloadStatusTerminated
)

Directories

Path Synopsis
Package charm provides the domain types for a charm.
Package charm provides the domain types for a charm.

Jump to

Keyboard shortcuts

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