application

package
v0.0.0-...-b9bb202 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

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             domaincharm.Charm
	CharmDownloadInfo *domaincharm.DownloadInfo
	Scale             int
	Platform          Platform
	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
}

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 AddUnitArg

type AddUnitArg struct {
	UnitName coreunit.Name
	UnitStatusArg
}

AddUnitArg contains parameters for adding a unit to state.

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 CloudContainerStatusStatusInfo

type CloudContainerStatusStatusInfo struct {
	StatusID CloudContainerStatusType
	StatusInfo
}

CloudContainerStatusStatusInfo holds a cloud container status and associated information.

type CloudContainerStatusType

type CloudContainerStatusType int

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

const (
	CloudContainerStatusWaiting CloudContainerStatusType = iota
	CloudContainerStatusBlocked
	CloudContainerStatusRunning
)

func MarshallCloudContainerStatus

func MarshallCloudContainerStatus(status corestatus.Status) CloudContainerStatusType

MarshallCloudContainerStatus converts a core status to a db cloud container status id.

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 {
	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 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 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 StatusInfo

type StatusInfo struct {
	Message string
	Data    map[string]string
	Since   time.Time
}

StatusInfo holds details about the status of an entity.

type UnitAgentStatusInfo

type UnitAgentStatusInfo struct {
	StatusID UnitAgentStatusType
	StatusInfo
}

UnitAgentStatusInfo holds a unit agent status and associated information.

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
)

func MarshallUnitAgentStatus

func MarshallUnitAgentStatus(status corestatus.Status) UnitAgentStatusType

MarshallUnitAgentStatus converts a core status to a db cunit agent status id.

type UnitStatusArg

type UnitStatusArg struct {
	AgentStatus    UnitAgentStatusInfo
	WorkloadStatus UnitWorkloadStatusInfo
}

UnitStatusArg contains parameters for updating a unit status in state.

type UnitWorkloadStatusInfo

type UnitWorkloadStatusInfo struct {
	StatusID UnitWorkloadStatusType
	StatusInfo
}

UnitWorkloadStatusInfo holds a unit workload status and associated information.

type UnitWorkloadStatusType

type UnitWorkloadStatusType int

UnitWorkloadStatusType represents the status of a unit workload as recorded in the unit_workload_status_value lookup table.

const (
	UnitWorkloadStatusUnset UnitWorkloadStatusType = iota
	UnitWorkloadStatusUnknown
	UnitWorkloadStatusMaintenance
	UnitWorkloadStatusWaiting
	UnitWorkloadStatusBlocked
	UnitWorkloadStatusActive
	UnitWorkloadStatusTerminated
)

func MarshallUnitWorkloadStatus

func MarshallUnitWorkloadStatus(status corestatus.Status) UnitWorkloadStatusType

MarshallUnitWorkloadStatus converts a core status to a db unit workload status id.

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