types

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name ID `json:"name"`
	*Meta
}

type BytesValue

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

func BytesFromMiB

func BytesFromMiB(mib uint) *BytesValue

func (*BytesValue) ToKubeMebibytes

func (v *BytesValue) ToKubeMebibytes() string

type Component

type Component struct {
	*PersistableComponent
	Addresses *ComponentAddresses `json:"addresses"`
}

type ComponentAddresses

type ComponentAddresses struct {
	External []*PortAddress `json:"external"`
	Internal []*PortAddress `json:"internal"`
}

type ContainerBlueprint

type ContainerBlueprint struct {
	Image  string              `json:"image"`
	Ports  []*Port             `json:"ports"`
	Env    []*EnvVar           `json:"env"`
	CPU    *ResourceAllocation `json:"cpu"`
	RAM    *ResourceAllocation `json:"ram"`
	Mounts []*Mount            `json:"mounts"`
}

Container ==============================================================================

type CoresValue

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

func CoresFromMillicores

func CoresFromMillicores(millicores uint) *CoresValue

func (*CoresValue) ToKubeMillicores

func (v *CoresValue) ToKubeMillicores() string

type CustomDeployScript

type CustomDeployScript struct {
	Image   string `json:"image"`
	Command string `json:"command"`
}

TODO implement...

type Entrypoint

type Entrypoint struct {
	Domain  ID     `json:"domain"`  // e.g. blog.qbox.io
	Address string `json:"address"` // the ELB address

	*Meta
}

Entrypoint ==============================================================================

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"` // this may be templated, "something_{{ instance_id }}"
}

EnvVar ==============================================================================

type ID

type ID *string

ID is defined as a string pointer in order to check for nil in the context of relations. NOTE this may not be best practice.

type ImageRepo

type ImageRepo struct {
	Name ID     `json:"name"`
	Key  string `json:"key"`

	*Meta
}

ImageRepo ==============================================================================

type Instance

type Instance struct {
	ID ID `json:"id"` // actually just the number (starting w/ 1) of the instance order in the release

	// BaseName is the name of the instance without the Release ID appended. It is
	// used for naming volumes, which move between releases.
	BaseName string `json:"base_name"`
	Name     string `json:"name"`

	Status InstanceStatus `json:"status"`
}

NOTE Instances are not stored in etcd, so the json tags here apply to HTTP

type InstanceStatus

type InstanceStatus string

Instance ==============================================================================

const (
	InstanceStatusStopped InstanceStatus = "STOPPED"
	InstanceStatusStarted InstanceStatus = "STARTED"
)

type Meta

type Meta struct {
	Created *Timestamp `json:"created"`
	Updated *Timestamp `json:"updated"`
	Tags    Tags       `json:"tags"`
}

Meta is a set of fields on all Resources for holding metadata.

func NewMeta

func NewMeta() *Meta

TODO weird placement

type Mount

type Mount struct {
	Volume ID     `json:"volume"` // TODO should be VolumeName
	Path   string `json:"path"`
}

Mount ==============================================================================

type PersistableComponent

type PersistableComponent struct {
	Name ID `json:"name"`
	// TODO kinda weird,
	// you choose a container that has the deploy file, and then reference it as a command
	CustomDeployScript *CustomDeployScript `json:"custom_deploy_script"`

	// TODO these all seem to be a departure in terms of relations... I feel like
	// there is a more elegant solution to house the info, and delete it atomically
	CurrentReleaseTimestamp ID `json:"current_release_id"`
	TargetReleaseTimestamp  ID `json:"target_release_id"`
	// We should just store the DeployTaskID but actually should render the task
	// when showing it in HTTP.
	DeployTaskID ID `json:"deploy_task_id"`

	*Meta
}

see note in core/resource.go about PersistableObject()

type Port

type Port struct {
	Protocol string `json:"protocol"`
	Number   int    `json:"number"` // should be uint
	Public   bool   `json:"public"`

	// EntrypointDomain specifies which Entrypoint this Port is added to. Does not
	// apply when Public is false.
	EntrypointDomain ID `json:"entrypoint_domain,omitempty"`

	// PreserveNumber instructs the Entrypoint to set the actual Port number
	// specified as the external load balancer port. Does not apply when
	// EntrypointDomain is nil.
	//
	// NOTE we may want to replace this with something like ExternalNumber so that
	// it is more flexible / obvious.
	PreserveNumber bool `json:"preserve_number"`
}

Port ==============================================================================

type PortAddress

type PortAddress struct {
	Port    string `json:"port"` // TODO really this should be the name of the port, which currently is the string of the number
	Address string `json:"address"`
}

type Release

type Release struct {
	// NOTE Timestamp here does not use the Timestamp type.
	Timestamp ID `json:"timestamp"`

	InstanceCount int `json:"instance_count"`

	// These attributes, when changed from last Release, indicate a restart is
	// needed (or just new instances through other means).
	Volumes                []*VolumeBlueprint    `json:"volumes"`
	Containers             []*ContainerBlueprint `json:"containers"`
	TerminationGracePeriod int                   `json:"termination_grace_period"`

	// Retired defines whether or not a Release still has active assets, like pods
	// or services. When retired is true, we skip attempting to delete assets.
	Retired bool `json:"retired"`

	*Meta
}

Release ============================================================================== NOTE the word Blueprint is used for Volumes and Containers, since they are both "definitions" that create "instances" of the real thing

type ResourceAllocation

type ResourceAllocation struct {
	Min uint `json:"min"`
	Max uint `json:"max"`
}

ResourceAllocation ==============================================================================

type Tags

type Tags map[string]string

Tags is a meta field for holding unstructued key/val info.

type Task

type Task struct {
	Type        TaskType `json:"type"`
	Data        []byte   `json:"data"`
	Status      string   `json:"status"`
	Attempts    int      `json:"attempts"`
	MaxAttempts int      `json:"max_attempts"` // this is static; config-level
	Error       string   `json:"error"`

	*Meta
}

type TaskType

type TaskType int

Task ==============================================================================

const (
	TaskTypeDeployComponent TaskType = iota
	TaskTypeDeleteComponent
	TaskTypeDeleteApp
	TaskTypeDeleteRelease
	TaskTypeStartInstance
	TaskTypeStopInstance
)

type Timestamp

type Timestamp struct {
	time.Time
}

func NewTimestamp

func NewTimestamp() *Timestamp

func (*Timestamp) MarshalJSON

func (t *Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(raw []byte) (err error)

type VolumeBlueprint

type VolumeBlueprint struct {
	Name ID     `json:"name"`
	Type string `json:"type"`
	Size int    `json:"size"`
}

Volume ==============================================================================

Jump to

Keyboard shortcuts

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