{"modulePath":"github.com/cceasy/executor","version":"v0.0.0-20170818023200-1ada6801ee19","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package executor\n\n## Constants\n\n```go\nconst (\n\tHealthcheckTag      = \"executor-healthcheck\"\n\tHealthcheckTagValue = \"executor-healthcheck\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tErrContainerGuidNotAvailable      = registerError(\"ContainerGuidNotAvailable\", \"container guid not available\", http.StatusBadRequest)\n\tErrContainerNotCompleted          = registerError(\"ContainerNotCompleted\", \"container must be stopped before it can be deleted\", http.StatusBadRequest)\n\tErrInsufficientResourcesAvailable = registerError(\"InsufficientResourcesAvailable\", \"insufficient resources available\", http.StatusServiceUnavailable)\n\tErrContainerNotFound              = registerError(\"ContainerNotFound\", \"container not found\", http.StatusNotFound)\n\tErrStepsInvalid                   = registerError(\"StepsInvalid\", \"steps invalid\", http.StatusBadRequest)\n\tErrLimitsInvalid                  = registerError(\"LimitsInvalid\", \"container limits invalid\", http.StatusBadRequest)\n\tErrGuidNotSpecified               = registerError(\"GuidNotSpecified\", \"container guid not specified\", http.StatusBadRequest)\n\tErrInvalidTransition              = registerError(\"InvalidStateTransition\", \"container cannot transition to given state\", http.StatusConflict)\n\tErrFailureToCheckSpace            = registerError(\"ErrFailureToCheckSpace\", \"failed to check available space\", http.StatusInternalServerError)\n\tErrInvalidSecurityGroup           = registerError(\"ErrInvalidSecurityGroup\", \"security group has invalid values\", http.StatusBadRequest)\n\tErrNoProcessToStop                = registerError(\"ErrNoProcessToStop\", \"failed to find a process to stop\", http.StatusNotFound)\n)\n```\n\n```go\nvar ErrUnknownEventType = errors.New(\"unknown event type\")\n```\n\n```go\nvar Errors = map[string]Error{}\n```\n\n## Functions\n\n```go\nfunc EnvironmentVariablesToModel(envVars []EnvironmentVariable) []models.EnvironmentVariable\n```\n\n## Types\n\n```go\ntype AllocationFailure struct {\n\tAllocationRequest\n\tErrorMsg string\n}\n```\n\n```go\nfunc NewAllocationFailure(req *AllocationRequest, msg string) AllocationFailure\n```\n\n```go\nfunc (fail *AllocationFailure) Error() string\n```\n\n```go\ntype AllocationRequest struct {\n\tGuid string\n\tResource\n\tTags\n}\n```\n\n```go\nfunc NewAllocationRequest(guid string, resource *Resource, tags Tags) AllocationRequest\n```\n\n```go\nfunc (a *AllocationRequest) Validate() error\n```\n\n```go\ntype BindMountMode uint8\n```\n\n```go\nconst (\n\tBindMountModeRO BindMountMode = 0\n\tBindMountModeRW BindMountMode = 1\n)\n```\n\n```go\ntype CachedDependency struct {\n\tName              string `json:\"name\"`\n\tFrom              string `json:\"from\"`\n\tTo                string `json:\"to\"`\n\tCacheKey          string `json:\"cache_key\"`\n\tLogSource         string `json:\"log_source\"`\n\tChecksumValue     string `json:\"checksum_value\"`\n\tChecksumAlgorithm string `json:\"checksum_algorithm\"`\n}\n```\n\n```go\ntype CertificateProperties struct {\n\tOrganizationalUnit []string `json:\"organizational_unit\"`\n}\n```\n\n```go\ntype Client interface {\n\tPing(logger lager.Logger) error\n\tAllocateContainers(logger lager.Logger, requests []AllocationRequest) ([]AllocationFailure, error)\n\tGetContainer(logger lager.Logger, guid string) (Container, error)\n\tRunContainer(lager.Logger, *RunRequest) error\n\tStopContainer(logger lager.Logger, guid string) error\n\tDeleteContainer(logger lager.Logger, guid string) error\n\tListContainers(lager.Logger) ([]Container, error)\n\tGetBulkMetrics(lager.Logger) (map[string]Metrics, error)\n\tRemainingResources(lager.Logger) (ExecutorResources, error)\n\tTotalResources(lager.Logger) (ExecutorResources, error)\n\tGetFiles(logger lager.Logger, guid string, path string) (io.ReadCloser, error)\n\tVolumeDrivers(logger lager.Logger) ([]string, error)\n\tSubscribeToEvents(lager.Logger) (EventSource, error)\n\tHealthy(lager.Logger) bool\n\tSetHealthy(lager.Logger, bool)\n\tCleanup(lager.Logger)\n}\n```\n\n```go\ntype Container struct {\n\tGuid string `json:\"guid\"`\n\tResource\n\tRunInfo\n\tTags        Tags\n\tState       State              `json:\"state\"`\n\tAllocatedAt int64              `json:\"allocated_at\"`\n\tExternalIP  string             `json:\"external_ip\"`\n\tInternalIP  string             `json:\"internal_ip\"`\n\tRunResult   ContainerRunResult `json:\"run_result\"`\n\tMemoryLimit uint64             `json:\"memory_limit\"`\n\tDiskLimit   uint64             `json:\"disk_limit\"`\n}\n```\n\n```go\nfunc NewContainerFromResource(guid string, resource *Resource, tags Tags) Container\n```\n\n```go\nfunc NewReservedContainerFromAllocationRequest(req *AllocationRequest, allocatedAt int64) Container\n```\n\n```go\nfunc (newContainer Container) Copy() Container\n```\n\n```go\nfunc (c *Container) HasTags(tags Tags) bool\n```\n\n```go\nfunc (c *Container) IsCreated() bool\n```\n\n```go\nfunc (c *Container) TransistionToCreate() error\n```\n\n```go\nfunc (c *Container) TransistionToInitialize(req *RunRequest) error\n```\n\n```go\nfunc (c *Container) TransitionToComplete(failed bool, failureReason string)\n```\n\n```go\nfunc (c *Container) ValidateTransitionTo(newState State) bool\n```\n\n```go\ntype ContainerCompleteEvent struct {\n\tRawContainer Container `json:\"container\"`\n}\n```\n\n```go\nfunc NewContainerCompleteEvent(container Container) ContainerCompleteEvent\n```\n\n```go\nfunc (e ContainerCompleteEvent) Container() Container\n```\n\n```go\nfunc (ContainerCompleteEvent) EventType() EventType\n```\n\n```go\ntype ContainerMetrics struct {\n\tMemoryUsageInBytes uint64        `json:\"memory_usage_in_bytes\"`\n\tDiskUsageInBytes   uint64        `json:\"disk_usage_in_bytes\"`\n\tMemoryLimitInBytes uint64        `json:\"memory_limit_in_bytes\"`\n\tDiskLimitInBytes   uint64        `json:\"disk_limit_in_bytes\"`\n\tTimeSpentInCPU     time.Duration `json:\"time_spent_in_cpu\"`\n}\n```\n\n```go\ntype ContainerReservedEvent struct {\n\tRawContainer Container `json:\"container\"`\n}\n```\n\n```go\nfunc NewContainerReservedEvent(container Container) ContainerReservedEvent\n```\n\n```go\nfunc (e ContainerReservedEvent) Container() Container\n```\n\n```go\nfunc (ContainerReservedEvent) EventType() EventType\n```\n\n```go\ntype ContainerRunResult struct {\n\tFailed        bool   `json:\"failed\"`\n\tFailureReason string `json:\"failure_reason\"`\n\n\tStopped bool `json:\"stopped\"`\n}\n```\n\n```go\ntype ContainerRunningEvent struct {\n\tRawContainer Container `json:\"container\"`\n}\n```\n\n```go\nfunc NewContainerRunningEvent(container Container) ContainerRunningEvent\n```\n\n```go\nfunc (e ContainerRunningEvent) Container() Container\n```\n\n```go\nfunc (ContainerRunningEvent) EventType() EventType\n```\n\n```go\ntype DiskLimitScope uint8\n```\n\n```go\nconst (\n\tExclusiveDiskLimit DiskLimitScope = iota\n\tTotalDiskLimit     DiskLimitScope = iota\n)\n```\n\n```go\ntype EnvironmentVariable struct {\n\tName  string `json:\"name\"`\n\tValue string `json:\"value\"`\n}\n```\n\n```go\nfunc EnvironmentVariablesFromModel(envVars []*models.EnvironmentVariable) []EnvironmentVariable\n```\n\n```go\ntype Error interface {\n\terror\n\n\tName() string\n\tHttpCode() int\n}\n```\n\n```go\ntype Event interface {\n\tEventType() EventType\n}\n```\n\n```go\ntype EventSource interface {\n\tNext() (Event, error)\n\tClose() error\n}\n```\n\n```go\ntype EventType string\n```\n\n```go\nconst (\n\tEventTypeInvalid EventType = \"\"\n\n\tEventTypeContainerComplete EventType = \"container_complete\"\n\tEventTypeContainerRunning  EventType = \"container_running\"\n\tEventTypeContainerReserved EventType = \"container_reserved\"\n)\n```\n\n```go\ntype ExecutorResources struct {\n\tMemoryMB   int `json:\"memory_mb\"`\n\tDiskMB     int `json:\"disk_mb\"`\n\tContainers int `json:\"containers\"`\n}\n```\n\n```go\nfunc NewExecutorResources(memoryMB, diskMB, containers int) ExecutorResources\n```\n\n```go\nfunc (r *ExecutorResources) Add(res *Resource)\n```\n\n```go\nfunc (e ExecutorResources) Copy() ExecutorResources\n```\n\n```go\nfunc (r *ExecutorResources) Subtract(res *Resource) bool\n```\n\n```go\ntype InnerContainer Container\n```\n\n```go\ntype LifecycleEvent interface {\n\tContainer() Container\n\t// contains filtered or unexported methods\n}\n```\n\n```go\ntype LogConfig struct {\n\tGuid       string `json:\"guid\"`\n\tIndex      int    `json:\"index\"`\n\tSourceName string `json:\"source_name\"`\n}\n```\n\n```go\ntype Metrics struct {\n\tMetricsConfig\n\tContainerMetrics\n}\n```\n\n```go\ntype MetricsConfig struct {\n\tGuid  string `json:\"guid\"`\n\tIndex int    `json:\"index\"`\n}\n```\n\n```go\ntype Network struct {\n\tProperties map[string]string `json:\"properties,omitempty\"`\n}\n```\n\n```go\ntype PortMapping struct {\n\tContainerPort uint16 `json:\"container_port\"`\n\tHostPort      uint16 `json:\"host_port,omitempty\"`\n}\n```\n\n```go\ntype Resource struct {\n\tMemoryMB   int    `json:\"memory_mb\"`\n\tDiskMB     int    `json:\"disk_mb\"`\n\tMaxPids    int    `json:\"max_pids\"`\n\tRootFSPath string `json:\"rootfs\"`\n}\n```\n\n```go\nfunc NewResource(memoryMB, diskMB, maxPids int, rootFSPath string) Resource\n```\n\n```go\ntype RunInfo struct {\n\tCPUWeight                     uint                        `json:\"cpu_weight\"`\n\tDiskScope                     DiskLimitScope              `json:\"disk_scope,omitempty\"`\n\tPorts                         []PortMapping               `json:\"ports\"`\n\tLogConfig                     LogConfig                   `json:\"log_config\"`\n\tMetricsConfig                 MetricsConfig               `json:\"metrics_config\"`\n\tStartTimeoutMs                uint                        `json:\"start_timeout_ms\"`\n\tPrivileged                    bool                        `json:\"privileged\"`\n\tCachedDependencies            []CachedDependency          `json:\"cached_dependencies\"`\n\tSetup                         *models.Action              `json:\"setup\"`\n\tAction                        *models.Action              `json:\"run\"`\n\tMonitor                       *models.Action              `json:\"monitor\"`\n\tCheckDefinition               *models.CheckDefinition     `json:\"check_definition\"`\n\tEgressRules                   []*models.SecurityGroupRule `json:\"egress_rules,omitempty\"`\n\tEnv                           []EnvironmentVariable       `json:\"env,omitempty\"`\n\tTrustedSystemCertificatesPath string                      `json:\"trusted_system_certificates_path,omitempty\"`\n\tVolumeMounts                  []VolumeMount               `json:\"volume_mounts\"`\n\tNetwork                       *Network                    `json:\"network,omitempty\"`\n\tCertificateProperties         CertificateProperties       `json:\"certificate_properties\"`\n\tImageUsername                 string                      `json:\"image_username\"`\n\tImagePassword                 string                      `json:\"image_password\"`\n}\n```\n\n```go\ntype RunRequest struct {\n\tGuid string\n\tRunInfo\n\tTags\n}\n```\n\n```go\nfunc NewRunRequest(guid string, runInfo *RunInfo, tags Tags) RunRequest\n```\n\n```go\ntype State string\n```\n\n```go\nconst (\n\tStateInvalid      State = \"\"\n\tStateReserved     State = \"reserved\"\n\tStateInitializing State = \"initializing\"\n\tStateCreated      State = \"created\"\n\tStateRunning      State = \"running\"\n\tStateCompleted    State = \"completed\"\n)\n```\n\n```go\ntype Tags map[string]string\n```\n\n```go\nfunc (t Tags) Add(other Tags)\n```\n\n```go\nfunc (t Tags) Copy() Tags\n```\n\n```go\ntype VolumeMount struct {\n\tDriver        string                 `json:\"driver\"`\n\tVolumeId      string                 `json:\"volume_id\"`\n\tConfig        map[string]interface{} `json:\"config\"`\n\tContainerPath string                 `json:\"container_path\"`\n\tMode          BindMountMode          `json:\"mode\"`\n}\n```\n\n```go\ntype WorkPoolSettings struct {\n\tCreateWorkPoolSize  int\n\tDeleteWorkPoolSize  int\n\tReadWorkPoolSize    int\n\tMetricsWorkPoolSize int\n}\n```\n\n","path":"github.com/cceasy/executor","name":"executor","synopsis":"","isRedistributable":true}
