session

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: 25 Imported by: 1

Documentation

Overview

Package session deals with appropriately reacting to all ACS messages as well as maintaining the connection to ACS.

Index

Constants

View Source
const (
	AttachResourceMessageName = "ConfirmAttachmentMessage"
	// DefaultAttachmentWaitTimeoutInMs is the default timeout, 5 minutes, for handling the attachments from ACS.
	DefaultAttachmentWaitTimeoutInMs = 300000
)
View Source
const (
	AttachInstanceENIMessageName = "AttachInstanceNetworkInterfacesMessage"
)
View Source
const (
	AttachTaskENIMessageName = "AttachTaskNetworkInterfacesMessage"
)
View Source
const (
	PayloadMessageName = "PayloadMessage"
)
View Source
const (
	RefreshCredentialsMessageName = "IAMRoleCredentialsMessage"
)
View Source
const (
	TaskManifestMessageName = "TaskManifestMessage"
)
View Source
const (
	TaskStopVerificationACKMessageName = "TaskStopVerificationACKMessage"
)

Variables

This section is empty.

Functions

func NewAttachInstanceENIResponder

func NewAttachInstanceENIResponder(eniHandler ENIHandler,
	responseSender wsclient.RespondFunc) wsclient.RequestResponder

NewAttachInstanceENIResponder returns an instance of the attachInstanceENIResponder struct.

func NewAttachResourceResponder

func NewAttachResourceResponder(resourceHandler ResourceHandler, metricsFactory metrics.EntryFactory,
	responseSender wsclient.RespondFunc) wsclient.RequestResponder

func NewAttachTaskENIResponder

func NewAttachTaskENIResponder(eniHandler ENIHandler, responseSender wsclient.RespondFunc) wsclient.RequestResponder

NewAttachTaskENIResponder returns an instance of the attachTaskENIResponder struct.

func NewHeartbeatResponder

func NewHeartbeatResponder(doctor *doctor.Doctor, responseSender wsclient.RespondFunc) wsclient.RequestResponder

NewHeartbeatResponder returns an instance of the heartbeatResponder struct.

func NewPayloadResponder

func NewPayloadResponder(payloadMessageHandler PayloadMessageHandler,
	responseSender wsclient.RespondFunc) wsclient.RequestResponder

NewPayloadResponder returns an instance of the payloadResponder struct.

func NewRefreshCredentialsResponder

func NewRefreshCredentialsResponder(credentialsManager credentials.Manager,
	credsMetadataSetter CredentialsMetadataSetter,
	metricsFactory metrics.EntryFactory,
	responseSender wsclient.RespondFunc) wsclient.RequestResponder

NewRefreshCredentialsResponder returns an instance of the refreshCredentialsResponder struct.

func NewTaskManifestResponder

func NewTaskManifestResponder(taskComparer TaskComparer, snAccessor SequenceNumberAccessor, messageIDAccessor ManifestMessageIDAccessor,
	metricsFactory metrics.EntryFactory, responseSender wsclient.RespondFunc) wsclient.RequestResponder

NewTaskManifestResponder returns an instance of the taskManifestResponder struct.

func NewTaskStopVerificationACKResponder

func NewTaskStopVerificationACKResponder(
	taskStopper TaskStopper,
	messageIDAccessor ManifestMessageIDAccessor,
	metricsFactory metrics.EntryFactory) wsclient.RequestResponder

NewTaskStopVerificationACKResponder returns an instance of the taskStopVerificationACKResponder struct.

Types

type CredentialsMetadataSetter

type CredentialsMetadataSetter interface {
	SetTaskRoleCredentialsMetadata(message *ecsacs.IAMRoleCredentialsMessage) error
	SetExecRoleCredentialsMetadata(message *ecsacs.IAMRoleCredentialsMessage) error
}

type ENIHandler

type ENIHandler interface {
	HandleENIAttachment(eniAttachment *ni.ENIAttachment) error
}

type ManifestMessageIDAccessor

type ManifestMessageIDAccessor interface {
	GetMessageID() string
	SetMessageID(messageID string) error
}

ManifestMessageIDAccessor stores the latest message ID that corresponds to the most recently processed task manifest message and is used to determine the validity of a task stop verification ack message.

type PayloadMessageHandler

type PayloadMessageHandler interface {
	ProcessMessage(message *ecsacs.PayloadMessage,
		ackFunc func(*ecsacs.AckRequest, []*ecsacs.IAMRoleCredentialsAckRequest)) error
}

type ResourceHandler

type ResourceHandler interface {
	HandleResourceAttachment(Attachment *resource.ResourceAttachment)
}

type SequenceNumberAccessor

type SequenceNumberAccessor interface {
	GetLatestSequenceNumber() int64
	SetLatestSequenceNumber(seqNum int64) error
}

SequenceNumberAccessor is used to get and set state for the current container instance. It sets and gets the latest sequence number that corresponds to the most recent task manifest that the task manifest responder has processed it alo sets the latest message id

type Session

type Session interface {
	Start(context.Context) error
	GetLastConnectedTime() time.Time
}

Session defines an interface for Agent's long-lived connection with ACS. The Session.Start() method can be used to start processing messages from ACS.

func NewSession

func NewSession(containerInstanceARN string,
	cluster string,
	ecsClient ecs.ECSClient,
	credentialsProvider *credentials.Credentials,
	inactiveInstanceCB func(),
	clientFactory wsclient.ClientFactory,
	metricsFactory metrics.EntryFactory,
	agentVersion string,
	agentHash string,
	dockerVersion string,
	minAgentConfig *wsclient.WSClientMinAgentConfig,
	payloadMessageHandler PayloadMessageHandler,
	credentialsManager rolecredentials.Manager,
	credentialsMetadataSetter CredentialsMetadataSetter,
	doctor *doctor.Doctor,
	eniHandler ENIHandler,
	manifestMessageIDAccessor ManifestMessageIDAccessor,
	taskComparer TaskComparer,
	sequenceNumberAccessor SequenceNumberAccessor,
	taskStopper TaskStopper,
	resourceHandler ResourceHandler,
	addUpdateRequestHandlers func(wsclient.ClientServer),
) Session

NewSession creates a new Session.

type TaskComparer

type TaskComparer interface {
	CompareRunningTasksOnInstanceWithManifest(*ecsacs.TaskManifestMessage) ([]*ecsacs.TaskIdentifier, error)
}

TaskComparer gets and compares running tasks on an instance to those in the ACS manifest. It should be implemented by an underlying struct that has access to such data.

type TaskStopper

type TaskStopper interface {
	StopTask(taskARN string)
}

Directories

Path Synopsis
Package mock_session is a generated GoMock package.
Package mock_session is a generated GoMock package.

Jump to

Keyboard shortcuts

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