agent/engine/dockerstate/docker_task_engine_state.go
func (state *DockerTaskEngineState) storeIDToContainerTaskUnsafe(container *apicontainer.DockerContainer, task *apitask.Task) {
	if container.DockerID != "" {
		// Update the container id to the state
		state.idToContainer[container.DockerID] = container
		state.idToTask[container.DockerID] = task.Arn

		// Remove the previously added name mapping
		delete(state.idToContainer, container.DockerName)
		delete(state.idToTask, container.DockerName)
	} else if container.DockerName != "" {
		// Update the container name mapping to the state when the ID isn't available
		state.idToContainer[container.DockerName] = container
		state.idToTask[container.DockerName] = task.Arn
	}
}
func (state *DockerTaskEngineState) storeIDToContainerTaskUnsafe(container *apicontainer.DockerContainer, task *apitask.Task) {
	if container.DockerID != "" {
		// Update the container id to the state
		state.idToContainer[container.DockerID] = container
		state.idToTask[container.DockerID] = task.Arn

		// Remove the previously added name mapping
		delete(state.idToContainer, container.DockerName)
		delete(state.idToTask, container.DockerName)
	} else if container.DockerName != "" {
		// Update the container name mapping to the state when the ID isn't available
		state.idToContainer[container.DockerName] = container
		state.idToTask[container.DockerName] = task.Arn
	}
}
func ( state * DockerTaskEngineState ) storeIDToContainerTaskUnsafe ( container * apicontainer . DockerContainer , task * apitask . Task ) { if container . DockerID != " " { // Update the container id to the state state . idToContainer [ container . DockerID ] = container state . idToTask [ container . DockerID ] = task . Arn // Remove the previously added name mapping delete ( state . idToContainer , container . DockerName ) delete ( state . idToTask , container . DockerName ) } else if container . DockerName != " " { // Update the container name mapping to the state when the ID isn't available state . idToContainer [ container . DockerName ] = container state . idToTask [ container . DockerName ] = task . Arn } }
// storeIDToContainerTaskUnsafe stores the container in the idToContainer and idToTask maps.  The key to the maps is
// either the Docker-generated ID or the agent-generated name (if the ID is not available).  If the container is updated
// with an ID, a subsequent call to this function will update the map to use the ID as the key.
storeIDToContainerTaskUnsafe stores the container in the idToContainer and idToTask maps . The key to the maps is either the Docker - generated ID or the agent - generated name ( if the ID is not available ) . If the container is updated with an ID a subsequent call to this function will update the map to use the ID as the key .