{"modulePath":"github.com/luan/executor","version":"v0.1441.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package executor\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)\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 Client interface {\n\tPing() error\n\tAllocateContainers(requests []AllocationRequest) ([]AllocationFailure, error)\n\tGetContainer(guid string) (Container, error)\n\tRunContainer(*RunRequest) error\n\tStopContainer(guid string) error\n\tDeleteContainer(guid string) error\n\tListContainers(Tags) ([]Container, error)\n\tGetAllMetrics(Tags) (map[string]Metrics, error)\n\tGetMetrics(guid string) (ContainerMetrics, error)\n\tRemainingResources() (ExecutorResources, error)\n\tRemainingResourcesFrom([]Container) (ExecutorResources, error)\n\tTotalResources() (ExecutorResources, error)\n\tGetFiles(guid string, path string) (io.ReadCloser, error)\n\tSubscribeToEvents() (EventSource, error)\n\tCleanup()\n}\n```\n\n```go\ntype ClientProvider interface {\n\tWithLogger(logger lager.Logger) Client\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\tRunResult   ContainerRunResult `json:\"run_result\"`\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\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\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) 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 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\tRootFSPath string `json:\"rootfs\"`\n}\n```\n\n```go\nfunc NewResource(memoryMB, diskMB 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\tStartTimeout  uint                        `json:\"start_timeout\"`\n\tPrivileged    bool                        `json:\"privileged\"`\n\tSetup         *models.Action              `json:\"setup\"`\n\tAction        *models.Action              `json:\"run\"`\n\tMonitor       *models.Action              `json:\"monitor\"`\n\tEgressRules   []*models.SecurityGroupRule `json:\"egress_rules,omitempty\"`\n\tEnv           []EnvironmentVariable       `json:\"env,omitempty\"`\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 WorkPoolSettings struct {\n\tCreateWorkPoolSize  int\n\tDeleteWorkPoolSize  int\n\tReadWorkPoolSize    int\n\tMetricsWorkPoolSize int\n}\n```\n\n","path":"github.com/luan/executor","name":"executor","synopsis":"","isRedistributable":true}
