Documentation ¶
Index ¶
- Constants
- Variables
- func FromJSON(payload []byte, v Validator) error
- func MarshalAction(a Action) ([]byte, error)
- func ToJSON(v Validator) ([]byte, error)
- func ToJSONArray(vs ...Validator) ([]byte, error)
- type Action
- type ActionType
- type ActualLRP
- func (before ActualLRP) AllowsTransitionTo(lrpKey ActualLRPKey, instanceKey ActualLRPInstanceKey, newState ActualLRPState) bool
- func (actual ActualLRP) CellIsMissing(cellSet CellSet) bool
- func (actual ActualLRP) ShouldRestartCrash(now time.Time, calc RestartCalculator) bool
- func (actual ActualLRP) ShouldRestartImmediately(calc RestartCalculator) bool
- func (actual ActualLRP) ShouldStartUnclaimed(now time.Time) bool
- func (actual ActualLRP) Validate() error
- type ActualLRPChange
- type ActualLRPGroup
- type ActualLRPGroupsByIndex
- type ActualLRPInstanceKey
- type ActualLRPKey
- type ActualLRPNetInfo
- type ActualLRPState
- type ActualLRPsByIndex
- type ActualLRPsByProcessGuidAndIndex
- type AuctioneerPresence
- type CellCapacity
- type CellPresence
- type CellSet
- type DesiredLRP
- type DesiredLRPChange
- type DesiredLRPUpdate
- type DesiredLRPsByProcessGuid
- type DomainSet
- type DownloadAction
- type EmitProgressAction
- type EnvironmentVariable
- type ErrInvalidField
- type ErrInvalidModification
- type ErrInvalidParameter
- type ICMPInfo
- type InnerDesiredLRP
- type InnerEmitProgressAction
- type InnerTask
- type LRPStartRequest
- type ModificationTag
- type ParallelAction
- type PortMapping
- type PortRange
- type ProtocolName
- type ReceptorPresence
- type ResourceLimits
- type RestartCalculator
- type RunAction
- type SecurityGroupRule
- type SerialAction
- type ServiceRegistration
- type ServiceRegistrations
- type StagingTaskAnnotation
- type Task
- type TaskState
- type TimeoutAction
- type TryAction
- type UploadAction
- type ValidationError
- type Validator
Constants ¶
View Source
const ( ActionTypeDownload ActionType = "download" ActionTypeEmitProgress = "emit_progress" ActionTypeRun = "run" ActionTypeUpload = "upload" ActionTypeTimeout = "timeout" ActionTypeTry = "try" ActionTypeParallel = "parallel" ActionTypeSerial = "serial" )
View Source
const CcBuildArtifactsUploadUriKey = "cc-build-artifacts-upload-uri"
View Source
const CcDropletUploadUriKey = "cc-droplet-upload-uri"
View Source
const CcTimeoutKey = "timeout"
View Source
const (
CellServiceName = "Cell"
)
View Source
const CrashBackoffMinDuration = 30 * time.Second
View Source
const DefaultImmediateRestarts = 3
View Source
const DefaultMaxBackoffDuration = 16 * time.Minute
View Source
const DefaultMaxRestarts = 200
View Source
const StaleUnclaimedActualLRPDuration = 30 * time.Second
Variables ¶
View Source
var ActualLRPStates = []ActualLRPState{ ActualLRPStateUnclaimed, ActualLRPStateClaimed, ActualLRPStateRunning, ActualLRPStateCrashed, }
View Source
var ErrActualLRPGroupInvalid = errors.New("ActualLRPGroup invalid")
View Source
var ErrInvalidActionType = errors.New("invalid action type")
Functions ¶
func MarshalAction ¶
func ToJSONArray ¶
Types ¶
type ActionType ¶
type ActionType string
type ActualLRP ¶
type ActualLRP struct { ActualLRPKey ActualLRPInstanceKey ActualLRPNetInfo CrashCount int `json:"crash_count"` State ActualLRPState `json:"state"` PlacementError string `json:"placement_error,omitempty"` Since int64 `json:"since"` ModificationTag ModificationTag `json:"modification_tag"` }
func (ActualLRP) AllowsTransitionTo ¶
func (before ActualLRP) AllowsTransitionTo(lrpKey ActualLRPKey, instanceKey ActualLRPInstanceKey, newState ActualLRPState) bool
func (ActualLRP) CellIsMissing ¶
func (ActualLRP) ShouldRestartCrash ¶
func (actual ActualLRP) ShouldRestartCrash(now time.Time, calc RestartCalculator) bool
func (ActualLRP) ShouldRestartImmediately ¶
func (actual ActualLRP) ShouldRestartImmediately(calc RestartCalculator) bool
func (ActualLRP) ShouldStartUnclaimed ¶
type ActualLRPChange ¶
type ActualLRPGroup ¶
type ActualLRPGroupsByIndex ¶
type ActualLRPGroupsByIndex map[int]ActualLRPGroup
func (ActualLRPGroupsByIndex) Slice ¶
func (actuals ActualLRPGroupsByIndex) Slice() []ActualLRPGroup
type ActualLRPInstanceKey ¶
type ActualLRPInstanceKey struct { InstanceGuid string `json:"instance_guid"` CellID string `json:"cell_id"` }
func NewActualLRPInstanceKey ¶
func NewActualLRPInstanceKey(instanceGuid string, cellID string) ActualLRPInstanceKey
func (*ActualLRPInstanceKey) Empty ¶
func (key *ActualLRPInstanceKey) Empty() bool
func (ActualLRPInstanceKey) Validate ¶
func (key ActualLRPInstanceKey) Validate() error
type ActualLRPKey ¶
type ActualLRPKey struct { ProcessGuid string `json:"process_guid"` Index int `json:"index"` Domain string `json:"domain"` }
func NewActualLRPKey ¶
func NewActualLRPKey(processGuid string, index int, domain string) ActualLRPKey
func (ActualLRPKey) Validate ¶
func (key ActualLRPKey) Validate() error
type ActualLRPNetInfo ¶
type ActualLRPNetInfo struct { Address string `json:"address"` Ports []PortMapping `json:"ports"` }
func EmptyActualLRPNetInfo ¶
func EmptyActualLRPNetInfo() ActualLRPNetInfo
func NewActualLRPNetInfo ¶
func NewActualLRPNetInfo(address string, ports []PortMapping) ActualLRPNetInfo
func (*ActualLRPNetInfo) Empty ¶
func (info *ActualLRPNetInfo) Empty() bool
func (ActualLRPNetInfo) Validate ¶
func (key ActualLRPNetInfo) Validate() error
type ActualLRPState ¶
type ActualLRPState string
const ( ActualLRPStateUnclaimed ActualLRPState = "UNCLAIMED" ActualLRPStateClaimed ActualLRPState = "CLAIMED" ActualLRPStateRunning ActualLRPState = "RUNNING" ActualLRPStateCrashed ActualLRPState = "CRASHED" )
type ActualLRPsByIndex ¶
func (ActualLRPsByIndex) Slice ¶
func (actuals ActualLRPsByIndex) Slice() []ActualLRP
type ActualLRPsByProcessGuidAndIndex ¶
type ActualLRPsByProcessGuidAndIndex map[string]ActualLRPsByIndex
func (ActualLRPsByProcessGuidAndIndex) Add ¶
func (set ActualLRPsByProcessGuidAndIndex) Add(actual ActualLRP)
func (ActualLRPsByProcessGuidAndIndex) Each ¶
func (set ActualLRPsByProcessGuidAndIndex) Each(predicate func(actual ActualLRP))
type AuctioneerPresence ¶
type AuctioneerPresence struct { AuctioneerID string `json:"auctioneer_id"` AuctioneerAddress string `json:"auctioneer_address"` }
func NewAuctioneerPresence ¶
func NewAuctioneerPresence(id, address string) AuctioneerPresence
func (AuctioneerPresence) Validate ¶
func (a AuctioneerPresence) Validate() error
type CellCapacity ¶
type CellCapacity struct { MemoryMB int `json:"memory_mb"` DiskMB int `json:"disk_mb"` Containers int `json:"containers"` }
func NewCellCapacity ¶
func NewCellCapacity(memoryMB, diskMB, containers int) CellCapacity
func (CellCapacity) Validate ¶
func (cap CellCapacity) Validate() error
type CellPresence ¶
type CellPresence struct { CellID string `json:"cell_id"` Stack string `json:"stack"` RepAddress string `json:"rep_address"` Zone string `json:"zone"` Capacity CellCapacity `json:"capacity"` }
func NewCellPresence ¶
func NewCellPresence(cellID, stack, repAddress, zone string, capacity CellCapacity) CellPresence
func (CellPresence) Validate ¶
func (c CellPresence) Validate() error
type CellSet ¶
type CellSet map[string]CellPresence
func (CellSet) Add ¶
func (set CellSet) Add(cell CellPresence)
func (CellSet) Each ¶
func (set CellSet) Each(predicate func(cell CellPresence))
type DesiredLRP ¶
type DesiredLRP struct { ProcessGuid string `json:"process_guid"` Domain string `json:"domain"` RootFSPath string `json:"rootfs"` Instances int `json:"instances"` Stack string `json:"stack"` EnvironmentVariables []EnvironmentVariable `json:"env,omitempty"` Setup Action `json:"-"` Action Action `json:"-"` StartTimeout uint `json:"start_timeout"` Monitor Action `json:"-"` DiskMB int `json:"disk_mb"` MemoryMB int `json:"memory_mb"` CPUWeight uint `json:"cpu_weight"` Privileged bool `json:"privileged"` Ports []uint16 `json:"ports"` Routes map[string]*json.RawMessage `json:"routes,omitempty"` LogSource string `json:"log_source"` LogGuid string `json:"log_guid"` MetricsGuid string `json:"metrics_guid"` Annotation string `json:"annotation,omitempty"` EgressRules []SecurityGroupRule `json:"egress_rules,omitempty"` ModificationTag ModificationTag `json:"modification_tag"` }
func (DesiredLRP) ApplyUpdate ¶
func (desired DesiredLRP) ApplyUpdate(update DesiredLRPUpdate) DesiredLRP
func (DesiredLRP) MarshalJSON ¶
func (desired DesiredLRP) MarshalJSON() ([]byte, error)
func (*DesiredLRP) UnmarshalJSON ¶
func (desired *DesiredLRP) UnmarshalJSON(payload []byte) error
func (DesiredLRP) Validate ¶
func (desired DesiredLRP) Validate() error
type DesiredLRPChange ¶
type DesiredLRPChange struct { Before DesiredLRP After DesiredLRP }
type DesiredLRPUpdate ¶
type DesiredLRPUpdate struct { Instances *int `json:"instances,omitempty"` Routes map[string]*json.RawMessage `json:"routes,omitempty"` Annotation *string `json:"annotation,omitempty"` }
type DesiredLRPsByProcessGuid ¶
type DesiredLRPsByProcessGuid map[string]DesiredLRP
func (DesiredLRPsByProcessGuid) Add ¶
func (set DesiredLRPsByProcessGuid) Add(desired DesiredLRP)
func (DesiredLRPsByProcessGuid) Each ¶
func (set DesiredLRPsByProcessGuid) Each(predicate func(desired DesiredLRP))
type DownloadAction ¶
type DownloadAction struct { Artifact string `json:"artifact,omitempty"` From string `json:"from"` To string `json:"to"` CacheKey string `json:"cache_key"` LogSource string `json:"log_source,omitempty"` }
func (*DownloadAction) ActionType ¶
func (a *DownloadAction) ActionType() ActionType
func (DownloadAction) Validate ¶
func (a DownloadAction) Validate() error
type EmitProgressAction ¶
type EmitProgressAction struct { Action Action `json:"-"` StartMessage string `json:"start_message"` SuccessMessage string `json:"success_message"` FailureMessagePrefix string `json:"failure_message_prefix"` LogSource string `json:"log_source,omitempty"` }
func EmitProgressFor ¶
func EmitProgressFor(action Action, startMessage string, successMessage string, failureMessagePrefix string) *EmitProgressAction
func (*EmitProgressAction) ActionType ¶
func (a *EmitProgressAction) ActionType() ActionType
func (*EmitProgressAction) MarshalJSON ¶
func (a *EmitProgressAction) MarshalJSON() ([]byte, error)
func (*EmitProgressAction) UnmarshalJSON ¶
func (a *EmitProgressAction) UnmarshalJSON(data []byte) error
func (EmitProgressAction) Validate ¶
func (a EmitProgressAction) Validate() error
type EnvironmentVariable ¶
type ErrInvalidField ¶
type ErrInvalidField struct {
Field string
}
func (ErrInvalidField) Error ¶
func (err ErrInvalidField) Error() string
type ErrInvalidModification ¶
type ErrInvalidModification struct {
InvalidField string
}
func (ErrInvalidModification) Error ¶
func (err ErrInvalidModification) Error() string
type ErrInvalidParameter ¶
type ErrInvalidParameter struct {
Parameter string
}
func (ErrInvalidParameter) Error ¶
func (err ErrInvalidParameter) Error() string
type InnerDesiredLRP ¶
type InnerDesiredLRP DesiredLRP
type InnerEmitProgressAction ¶
type InnerEmitProgressAction EmitProgressAction
type LRPStartRequest ¶
type LRPStartRequest struct { DesiredLRP DesiredLRP `json:"desired_lrp"` Indices []uint `json:"indices"` }
func NewLRPStartRequest ¶
func NewLRPStartRequest(d DesiredLRP, indices ...uint) LRPStartRequest
func (LRPStartRequest) Validate ¶
func (lrpstart LRPStartRequest) Validate() error
type ModificationTag ¶
func (*ModificationTag) Increment ¶
func (t *ModificationTag) Increment()
type ParallelAction ¶
func Parallel ¶
func Parallel(actions ...Action) *ParallelAction
func (*ParallelAction) ActionType ¶
func (a *ParallelAction) ActionType() ActionType
func (*ParallelAction) MarshalJSON ¶
func (a *ParallelAction) MarshalJSON() ([]byte, error)
func (*ParallelAction) UnmarshalJSON ¶
func (a *ParallelAction) UnmarshalJSON(data []byte) error
func (ParallelAction) Validate ¶
func (a ParallelAction) Validate() error
type PortMapping ¶
type ProtocolName ¶
type ProtocolName string
const ( TCPProtocol ProtocolName = "tcp" UDPProtocol ProtocolName = "udp" ICMPProtocol ProtocolName = "icmp" AllProtocol ProtocolName = "all" )
type ReceptorPresence ¶
func NewReceptorPresence ¶
func NewReceptorPresence(id, url string) ReceptorPresence
func (ReceptorPresence) Validate ¶
func (r ReceptorPresence) Validate() error
type ResourceLimits ¶
type ResourceLimits struct {
Nofile *uint64 `json:"nofile,omitempty"`
}
type RestartCalculator ¶
type RestartCalculator struct { ImmediateRestarts int `json:"immediate_restarts"` MaxBackoffCount int `json:"max_backoff_count"` MaxBackoffDuration time.Duration `json:"max_backoff_duration"` MaxRestartAttempts int `json:"max_restart_attempts"` }
func NewDefaultRestartCalculator ¶
func NewDefaultRestartCalculator() RestartCalculator
func NewRestartCalculator ¶
func NewRestartCalculator(immediateRestarts int, maxBackoffDuration time.Duration, maxRestarts int) RestartCalculator
func (RestartCalculator) ShouldRestart ¶
func (r RestartCalculator) ShouldRestart(now, crashedAt int64, crashCount int) bool
func (RestartCalculator) Validate ¶
func (r RestartCalculator) Validate() error
type RunAction ¶
type RunAction struct { Path string `json:"path"` Args []string `json:"args"` Dir string `json:"dir,omitempty"` Env []EnvironmentVariable `json:"env"` ResourceLimits ResourceLimits `json:"resource_limits"` Privileged bool `json:"privileged,omitempty"` LogSource string `json:"log_source,omitempty"` }
func (*RunAction) ActionType ¶
func (a *RunAction) ActionType() ActionType
type SecurityGroupRule ¶
type SecurityGroupRule struct { Protocol ProtocolName `json:"protocol"` Destinations []string `json:"destinations"` Ports []uint16 `json:"ports,omitempty"` PortRange *PortRange `json:"port_range,omitempty"` IcmpInfo *ICMPInfo `json:"icmp_info,omitempty"` Log bool `json:"log"` }
func (SecurityGroupRule) Validate ¶
func (rule SecurityGroupRule) Validate() error
type SerialAction ¶
func Serial ¶
func Serial(actions ...Action) *SerialAction
func (*SerialAction) ActionType ¶
func (a *SerialAction) ActionType() ActionType
func (*SerialAction) MarshalJSON ¶
func (a *SerialAction) MarshalJSON() ([]byte, error)
func (*SerialAction) UnmarshalJSON ¶
func (a *SerialAction) UnmarshalJSON(data []byte) error
func (SerialAction) Validate ¶
func (a SerialAction) Validate() error
type ServiceRegistration ¶
type ServiceRegistrations ¶
type ServiceRegistrations []ServiceRegistration
func (ServiceRegistrations) FilterByName ¶
func (s ServiceRegistrations) FilterByName(serviceName string) ServiceRegistrations
type StagingTaskAnnotation ¶
type Task ¶
type Task struct { TaskGuid string `json:"task_guid"` Domain string `json:"domain"` RootFSPath string `json:"rootfs"` Stack string `json:"stack"` EnvironmentVariables []EnvironmentVariable `json:"env,omitempty"` Action Action `json:"-"` MemoryMB int `json:"memory_mb"` Privileged bool `json:"privileged"` DiskMB int `json:"disk_mb"` CPUWeight uint `json:"cpu_weight"` LogGuid string `json:"log_guid"` LogSource string `json:"log_source"` MetricsGuid string `json:"metrics_guid"` CreatedAt int64 `json:"created_at"` // the number of nanoseconds elapsed since January 1, 1970 UTC UpdatedAt int64 `json:"updated_at"` FirstCompletedAt int64 `json:"first_completed_at"` ResultFile string `json:"result_file"` State TaskState `json:"state"` CellID string `json:"cell_id"` Result string `json:"result"` Failed bool `json:"failed"` FailureReason string `json:"failure_reason"` CompletionCallbackURL *url.URL `json:"completion_callback_url,omitempty"` Annotation string `json:"annotation,omitempty"` EgressRules []SecurityGroupRule `json:"egress_rules,omitempty"` }
func (Task) MarshalJSON ¶
func (*Task) UnmarshalJSON ¶
type TimeoutAction ¶
func (*TimeoutAction) ActionType ¶
func (a *TimeoutAction) ActionType() ActionType
func (*TimeoutAction) MarshalJSON ¶
func (a *TimeoutAction) MarshalJSON() ([]byte, error)
func (*TimeoutAction) UnmarshalJSON ¶
func (a *TimeoutAction) UnmarshalJSON(data []byte) error
func (TimeoutAction) Validate ¶
func (a TimeoutAction) Validate() error
type TryAction ¶
func (*TryAction) ActionType ¶
func (a *TryAction) ActionType() ActionType
func (*TryAction) MarshalJSON ¶
func (*TryAction) UnmarshalJSON ¶
type UploadAction ¶
type UploadAction struct { Artifact string `json:"artifact,omitempty"` To string `json:"to"` From string `json:"from"` LogSource string `json:"log_source,omitempty"` }
func (*UploadAction) ActionType ¶
func (a *UploadAction) ActionType() ActionType
func (UploadAction) Validate ¶
func (a UploadAction) Validate() error
type ValidationError ¶
type ValidationError []error
func (ValidationError) Append ¶
func (ve ValidationError) Append(err error) ValidationError
func (ValidationError) Empty ¶
func (ve ValidationError) Empty() bool
func (ValidationError) Error ¶
func (ve ValidationError) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.