data

package
v0.0.0-...-b702281 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 16 Imported by: 21

Documentation

Index

Constants

View Source
const (
	AgentVersionKey         = "agent-version"
	AvailabilityZoneKey     = "availability-zone"
	ClusterNameKey          = "cluster-name"
	ContainerInstanceARNKey = "container-instance-arn"
	EC2InstanceIDKey        = "ec2-instance-id"
	TaskManifestSeqNumKey   = "task-manifest-seq-num"
)

Variables

This section is empty.

Functions

func GetContainerID

func GetContainerID(c *apicontainer.Container) (string, error)

GetContainerID returns a unique ID for a container to use as key when saving to DB.

Types

type Client

type Client interface {
	// SaveContainer saves the data of a container.
	SaveContainer(*container.Container) error
	// SaveDockerContainer saves the data of a docker container.
	// We have both SaveContainer and SaveDockerContainer so that a caller who doesn't have docker information
	// of the container can save container with SaveContainer, while a caller who wants to save the docker
	// information of the container can save it with SaveDockerContainer.
	SaveDockerContainer(*container.DockerContainer) error
	// DeleteContainer deletes the data of a container.
	DeleteContainer(string) error
	// GetContainers gets the data of all the containers.
	GetContainers() ([]*container.DockerContainer, error)

	// SaveTask saves the data of a task.
	SaveTask(*task.Task) error
	// DeleteTask deletes the data of a task.
	DeleteTask(string) error
	// GetTasks gets the data of all the tasks.
	GetTasks() ([]*task.Task, error)

	// SaveImageState saves the data of an image state.
	SaveImageState(*image.ImageState) error
	// DeleteImageState deletes the data of an image state.
	DeleteImageState(string) error
	// GetImageStates gets the data of all the image states.
	GetImageStates() ([]*image.ImageState, error)

	// SaveENIAttachment saves the data of an ENI attachment.
	SaveENIAttachment(*networkinterface.ENIAttachment) error
	// DeleteENIAttachment deletes the data of an ENI atttachment.
	DeleteENIAttachment(string) error
	// GetENIAttachments gets the data of all the ENI attachments.
	GetENIAttachments() ([]*networkinterface.ENIAttachment, error)

	// SaveResourceAttachment saves the data of a resource attachment.
	// This includes the EBS Attachment type
	SaveResourceAttachment(*resource.ResourceAttachment) error
	// DeleteResourceAttachment deletes the data of a resource atttachment.
	DeleteResourceAttachment(string) error
	// GetResourceAttachments gets the data of all the resouce attachments.
	GetResourceAttachments() ([]*resource.ResourceAttachment, error)

	// SaveMetadata saves a key value pair of metadata.
	SaveMetadata(string, string) error
	// GetMetadata gets the value of a certain kind of metadata.
	GetMetadata(string) (string, error)

	// Close closes the connection to database.
	Close() error
}

Client specifies the data management interface to persist and manage various kinds of data in the agent.

func New

func New(dataDir string) (Client, error)

New returns a data client that implements the Client interface with boltdb.

func NewNoopClient

func NewNoopClient() Client

NewNoopClient returns a client that implements the data interface with no-op. It is used by the agent when ECS_CHECKPOINT is set to false, and is also used in testing.

func NewWithSetup

func NewWithSetup(dataDir string) (Client, error)

NewWithSetup returns a data client that implements the Client interface with boltdb. It always runs the db setup. Used for testing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL