Documentation ¶
Index ¶
- type DockerTaskEngineState
- func (state *DockerTaskEngineState) AddContainer(container *apicontainer.DockerContainer, task *apitask.Task)
- func (state *DockerTaskEngineState) AddEBSAttachment(ebsAttachment *apiresource.ResourceAttachment)
- func (state *DockerTaskEngineState) AddENIAttachment(eniAttachment *ni.ENIAttachment)
- func (state *DockerTaskEngineState) AddImageState(imageState *image.ImageState)
- func (state *DockerTaskEngineState) AddPulledContainer(container *apicontainer.DockerContainer, task *apitask.Task)
- func (state *DockerTaskEngineState) AddTask(task *apitask.Task)
- func (state *DockerTaskEngineState) AddTaskIPAddress(addr string, taskARN string)
- func (state *DockerTaskEngineState) AllENIAttachments() []*ni.ENIAttachment
- func (state *DockerTaskEngineState) AllExternalTasks() []*apitask.Task
- func (state *DockerTaskEngineState) AllImageStates() []*image.ImageState
- func (state *DockerTaskEngineState) AllTasks() []*apitask.Task
- func (state *DockerTaskEngineState) ContainerByID(id string) (*apicontainer.DockerContainer, bool)
- func (state *DockerTaskEngineState) ContainerMapByArn(arn string) (map[string]*apicontainer.DockerContainer, bool)
- func (state *DockerTaskEngineState) DockerIDByV3EndpointID(v3EndpointID string) (string, bool)
- func (state *DockerTaskEngineState) ENIByMac(mac string) (*ni.ENIAttachment, bool)
- func (state *DockerTaskEngineState) GetAllContainerIDs() []string
- func (state *DockerTaskEngineState) GetAllEBSAttachments() []*apiresource.ResourceAttachment
- func (state *DockerTaskEngineState) GetAllPendingEBSAttachments() []*apiresource.ResourceAttachment
- func (state *DockerTaskEngineState) GetAllPendingEBSAttachmentsWithKey() map[string]*apiresource.ResourceAttachment
- func (state *DockerTaskEngineState) GetEBSByVolumeId(volumeId string) (*apiresource.ResourceAttachment, bool)
- func (state *DockerTaskEngineState) GetIPAddressByTaskARN(taskARN string) (string, bool)
- func (state *DockerTaskEngineState) GetTaskByIPAddress(addr string) (string, bool)
- func (state *DockerTaskEngineState) MarshalJSON() ([]byte, error)
- func (state *DockerTaskEngineState) PulledContainerMapByArn(arn string) (map[string]*apicontainer.DockerContainer, bool)
- func (state *DockerTaskEngineState) RemoveEBSAttachment(volumeId string)
- func (state *DockerTaskEngineState) RemoveENIAttachment(mac string)
- func (state *DockerTaskEngineState) RemoveImageState(imageState *image.ImageState)
- func (state *DockerTaskEngineState) RemoveTask(task *apitask.Task)
- func (state *DockerTaskEngineState) Reset()
- func (state *DockerTaskEngineState) TaskARNByV3EndpointID(v3EndpointID string) (string, bool)
- func (state *DockerTaskEngineState) TaskByArn(arn string) (*apitask.Task, bool)
- func (state *DockerTaskEngineState) TaskByID(cid string) (*apitask.Task, bool)
- func (state *DockerTaskEngineState) TaskByShortID(cid string) ([]*apitask.Task, bool)
- func (state *DockerTaskEngineState) UnmarshalJSON(data []byte) error
- type TaskEngineState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerTaskEngineState ¶
type DockerTaskEngineState struct {
// contains filtered or unexported fields
}
DockerTaskEngineState keeps track of all mappings between tasks we know about and containers docker runs It contains a mutex that can be used to ensure out-of-date state cannot be accessed before an update comes and to ensure multiple goroutines can safely work with it.
The methods on it will acquire the read lock, but not all acquire the write lock (sometimes it is up to the caller). This is because the write lock for containers should encapsulate the creation of the resource as well as adding, and creating the resource (docker container) is outside the scope of this package. This isn't ideal usage and I'm open to this being reworked/improved.
Some information is duplicated in the interest of having efficient lookups
func (*DockerTaskEngineState) AddContainer ¶
func (state *DockerTaskEngineState) AddContainer(container *apicontainer.DockerContainer, task *apitask.Task)
AddContainer adds a container to the state. If the container has been added with only a name and no docker-id, this updates the state to include the docker id
func (*DockerTaskEngineState) AddEBSAttachment ¶
func (state *DockerTaskEngineState) AddEBSAttachment(ebsAttachment *apiresource.ResourceAttachment)
AddEBSAttachment adds the ebs volume to state
func (*DockerTaskEngineState) AddENIAttachment ¶
func (state *DockerTaskEngineState) AddENIAttachment(eniAttachment *ni.ENIAttachment)
AddENIAttachment adds the eni into the state
func (*DockerTaskEngineState) AddImageState ¶
func (state *DockerTaskEngineState) AddImageState(imageState *image.ImageState)
AddImageState adds an image.ImageState to be stored
func (*DockerTaskEngineState) AddPulledContainer ¶
func (state *DockerTaskEngineState) AddPulledContainer(container *apicontainer.DockerContainer, task *apitask.Task)
AddPulledContainer adds a pulled container to the state
func (*DockerTaskEngineState) AddTask ¶
func (state *DockerTaskEngineState) AddTask(task *apitask.Task)
AddTask adds a new task to the state
func (*DockerTaskEngineState) AddTaskIPAddress ¶
func (state *DockerTaskEngineState) AddTaskIPAddress(addr string, taskARN string)
AddTaskIPAddress adds ip adddress for a task arn into the state
func (*DockerTaskEngineState) AllENIAttachments ¶
func (state *DockerTaskEngineState) AllENIAttachments() []*ni.ENIAttachment
AllENIAttachments returns all the enis managed by ecs on the instance
func (*DockerTaskEngineState) AllExternalTasks ¶
func (state *DockerTaskEngineState) AllExternalTasks() []*apitask.Task
AllExternalTasks returns all tasks with IsInternal==false (i.e. all customer-initiated tasks)
func (*DockerTaskEngineState) AllImageStates ¶
func (state *DockerTaskEngineState) AllImageStates() []*image.ImageState
AllImageStates returns all of the image.ImageStates
func (*DockerTaskEngineState) AllTasks ¶
func (state *DockerTaskEngineState) AllTasks() []*apitask.Task
AllTasks returns all of the tasks
func (*DockerTaskEngineState) ContainerByID ¶
func (state *DockerTaskEngineState) ContainerByID(id string) (*apicontainer.DockerContainer, bool)
ContainerByID returns an apicontainer.DockerContainer for a given container ID
func (*DockerTaskEngineState) ContainerMapByArn ¶
func (state *DockerTaskEngineState) ContainerMapByArn(arn string) (map[string]*apicontainer.DockerContainer, bool)
ContainerMapByArn returns a map of containers belonging to a particular task ARN
func (*DockerTaskEngineState) DockerIDByV3EndpointID ¶
func (state *DockerTaskEngineState) DockerIDByV3EndpointID(v3EndpointID string) (string, bool)
DockerIDByV3EndpointID returns a docker ID for a given v3 endpoint ID
func (*DockerTaskEngineState) ENIByMac ¶
func (state *DockerTaskEngineState) ENIByMac(mac string) (*ni.ENIAttachment, bool)
ENIByMac returns the eni object that match the give mac address
func (*DockerTaskEngineState) GetAllContainerIDs ¶
func (state *DockerTaskEngineState) GetAllContainerIDs() []string
GetAllContainerIDs returns all of the Container Ids
func (*DockerTaskEngineState) GetAllEBSAttachments ¶
func (state *DockerTaskEngineState) GetAllEBSAttachments() []*apiresource.ResourceAttachment
GetAllEBSAttachments returns all the ebs volumes managed by ecs on the instance
func (*DockerTaskEngineState) GetAllPendingEBSAttachments ¶
func (state *DockerTaskEngineState) GetAllPendingEBSAttachments() []*apiresource.ResourceAttachment
GetAllPendingEBSAttachments returns all the ebs volumes managed by ecs on the instance that haven't been found attached on the host
func (*DockerTaskEngineState) GetAllPendingEBSAttachmentsWithKey ¶
func (state *DockerTaskEngineState) GetAllPendingEBSAttachmentsWithKey() map[string]*apiresource.ResourceAttachment
GetAllPendingEBSAttachmentsWithKey returns all the ebs volumes managed by ecs on the instance that haven't been found attached on the host as a map with the corresponding volume ID as the key
func (*DockerTaskEngineState) GetEBSByVolumeId ¶
func (state *DockerTaskEngineState) GetEBSByVolumeId(volumeId string) (*apiresource.ResourceAttachment, bool)
GetEBSByVolumeId returns the ebs object that matches the given volume ID
func (*DockerTaskEngineState) GetIPAddressByTaskARN ¶
func (state *DockerTaskEngineState) GetIPAddressByTaskARN(taskARN string) (string, bool)
GetIPAddressByTaskARN gets the local ip address of a task.
func (*DockerTaskEngineState) GetTaskByIPAddress ¶
func (state *DockerTaskEngineState) GetTaskByIPAddress(addr string) (string, bool)
GetTaskByIPAddress gets the task arn for an IP address
func (*DockerTaskEngineState) MarshalJSON ¶
func (state *DockerTaskEngineState) MarshalJSON() ([]byte, error)
func (*DockerTaskEngineState) PulledContainerMapByArn ¶
func (state *DockerTaskEngineState) PulledContainerMapByArn(arn string) (map[string]*apicontainer.DockerContainer, bool)
PulledContainerMapByArn returns a map of pulled containers belonging to a particular task ARN
func (*DockerTaskEngineState) RemoveEBSAttachment ¶
func (state *DockerTaskEngineState) RemoveEBSAttachment(volumeId string)
RemoveEBSAttachment removes the ebs volume from state and stops managing
func (*DockerTaskEngineState) RemoveENIAttachment ¶
func (state *DockerTaskEngineState) RemoveENIAttachment(mac string)
RemoveENIAttachment removes the eni from state and stop managing
func (*DockerTaskEngineState) RemoveImageState ¶
func (state *DockerTaskEngineState) RemoveImageState(imageState *image.ImageState)
RemoveImageState removes an image.ImageState
func (*DockerTaskEngineState) RemoveTask ¶
func (state *DockerTaskEngineState) RemoveTask(task *apitask.Task)
RemoveTask removes a task from this state. It removes all containers and other associated metadata. It does acquire the write lock.
func (*DockerTaskEngineState) Reset ¶
func (state *DockerTaskEngineState) Reset()
Reset resets all the states
func (*DockerTaskEngineState) TaskARNByV3EndpointID ¶
func (state *DockerTaskEngineState) TaskARNByV3EndpointID(v3EndpointID string) (string, bool)
TaskARNByV3EndpointID returns a taskARN for a given v3 endpoint ID
func (*DockerTaskEngineState) TaskByArn ¶
func (state *DockerTaskEngineState) TaskByArn(arn string) (*apitask.Task, bool)
TaskByArn returns a task for a given ARN
func (*DockerTaskEngineState) TaskByID ¶
func (state *DockerTaskEngineState) TaskByID(cid string) (*apitask.Task, bool)
TaskByID retrieves the task of a given docker container id
func (*DockerTaskEngineState) TaskByShortID ¶
func (state *DockerTaskEngineState) TaskByShortID(cid string) ([]*apitask.Task, bool)
TaskByShortID retrieves the task of a given docker short container id
func (*DockerTaskEngineState) UnmarshalJSON ¶
func (state *DockerTaskEngineState) UnmarshalJSON(data []byte) error
type TaskEngineState ¶
type TaskEngineState interface { // AllTasks returns all of the tasks AllTasks() []*apitask.Task // AllExternalTasks returns all tasks with IsInternal==false (i.e. customer-initiated tasks). // Currently, ServiceConnect AppNet Relay task is the only internal task. AllExternalTasks() []*apitask.Task // AllENIAttachments returns all of the eni attachments AllENIAttachments() []*ni.ENIAttachment // AllImageStates returns all of the image.ImageStates AllImageStates() []*image.ImageState // GetAllContainerIDs returns all of the Container Ids GetAllContainerIDs() []string // ContainerByID returns an apicontainer.DockerContainer for a given container ID ContainerByID(id string) (*apicontainer.DockerContainer, bool) // ContainerMapByArn returns a map of containers belonging to a particular task ARN ContainerMapByArn(arn string) (map[string]*apicontainer.DockerContainer, bool) // PulledContainerMapByArn returns a map of pulled containers belonging to a particular task ARN PulledContainerMapByArn(arn string) (map[string]*apicontainer.DockerContainer, bool) // TaskByShortID retrieves the task of a given docker short container id TaskByShortID(cid string) ([]*apitask.Task, bool) // TaskByID returns an apitask.Task for a given container ID TaskByID(cid string) (*apitask.Task, bool) // TaskByArn returns a task for a given ARN TaskByArn(arn string) (*apitask.Task, bool) // AddTask adds a task to the state to be stored AddTask(task *apitask.Task) // AddPulledContainer adds a pulled container to the state to be stored for a given task AddPulledContainer(container *apicontainer.DockerContainer, task *apitask.Task) // AddContainer adds a container to the state to be stored for a given task AddContainer(container *apicontainer.DockerContainer, task *apitask.Task) // AddImageState adds an image.ImageState to be stored AddImageState(imageState *image.ImageState) // AddENIAttachment adds an eni attachment from acs to be stored AddENIAttachment(eni *ni.ENIAttachment) // RemoveENIAttachment removes an eni attachment to stop tracking RemoveENIAttachment(mac string) // ENIByMac returns the specific ENIAttachment of the given mac address ENIByMac(mac string) (*ni.ENIAttachment, bool) // RemoveTask removes a task from the state RemoveTask(task *apitask.Task) // Reset resets all the fileds in the state Reset() // RemoveImageState removes an image.ImageState RemoveImageState(imageState *image.ImageState) // AddTaskIPAddress adds ip adddress for a task arn into the state AddTaskIPAddress(addr string, taskARN string) // GetTaskByIPAddress gets the task arn for an IP address GetTaskByIPAddress(addr string) (string, bool) // GetIPAddressByTaskARN gets the local ip address of a task. GetIPAddressByTaskARN(taskARN string) (string, bool) // DockerIDByV3EndpointID returns a docker ID for a given v3 endpoint ID DockerIDByV3EndpointID(v3EndpointID string) (string, bool) // TaskARNByV3EndpointID returns a taskARN for a given v3 endpoint ID TaskARNByV3EndpointID(v3EndpointID string) (string, bool) // GetAllEBSAttachments returns all of the ebs attachments GetAllEBSAttachments() []*apiresource.ResourceAttachment // AllPendingEBSAttachments reutrns all of the ebs attachments that haven't sent a state change GetAllPendingEBSAttachments() []*apiresource.ResourceAttachment // GetAllPendingEBSAttachmentWithKey returns a map of all pending ebs attachments along with the corresponding volume ID as the key GetAllPendingEBSAttachmentsWithKey() map[string]*apiresource.ResourceAttachment // AddEBSAttachment adds an ebs attachment from acs to be stored AddEBSAttachment(ebs *apiresource.ResourceAttachment) // RemoveEBSAttachment removes an ebs attachment to stop tracking RemoveEBSAttachment(volumeId string) // EBSByVolumeId returns the specific EBSAttachment of the given volume ID GetEBSByVolumeId(volumeId string) (*apiresource.ResourceAttachment, bool) json.Marshaler json.Unmarshaler }
TaskEngineState keeps track of all mappings between tasks we know about and containers docker runs
func NewTaskEngineState ¶
func NewTaskEngineState() TaskEngineState
NewTaskEngineState returns a new TaskEngineState
Directories ¶
Path | Synopsis |
---|---|
Package mock_dockerstate is a generated GoMock package.
|
Package mock_dockerstate is a generated GoMock package. |
Package testutils contains files that are used in tests but not elsewhere and thus can be excluded from the final executable.
|
Package testutils contains files that are used in tests but not elsewhere and thus can be excluded from the final executable. |