queue

package
v0.0.0-...-93529e1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageQueueMessage

type ImageQueueMessage struct {
	ImageName     string `json:"ImageName"`
	ReceiptHandle *string
}

ImageQueueMessage is sent to the queue to trigger an inspection.

type MockService

type MockService struct{}

MockService for tests

func NewMockService

func NewMockService() MockService

func (MockService) DeleteImage

func (q MockService) DeleteImage(img *ImageQueueMessage) error

DeleteImage on mock queue always succeeds

func (MockService) DeleteNotification

func (q MockService) DeleteNotification(notify *NotificationQueueMessage) error

DeleteNotification on mock queue always succeeds

func (MockService) ReceiveImage

func (q MockService) ReceiveImage() *ImageQueueMessage

ReceiveImage on mock queue always succeeds

func (MockService) ReceiveNotification

func (q MockService) ReceiveNotification() *NotificationQueueMessage

ReceiveNotification on mock queue always succeeds

func (MockService) SendImage

func (q MockService) SendImage(imageName string, state string) (err error)

SendImage on mock queue always succeeds

func (MockService) SendNotification

func (q MockService) SendNotification(id uint) (err error)

SendNotification on mock queue always succeeds

type NatsService

type NatsService struct {
	// contains filtered or unexported fields
}

NatsService for sending and receiving messages to Nats.

func NewNatsService

func NewNatsService() NatsService

NewNatsService opens a new session with Nats.

func (NatsService) DeleteImage

func (q NatsService) DeleteImage(img *ImageQueueMessage) error

DeleteImage from the queue once it has successfully been inspected.

func (NatsService) DeleteNotification

func (q NatsService) DeleteNotification(notification *NotificationQueueMessage) error

DeleteNotification from the queue once it has been sent.

func (NatsService) ReceiveImage

func (q NatsService) ReceiveImage() *ImageQueueMessage

ReceiveImage from the Nats queue for processing by the inspector.

func (NatsService) ReceiveNotification

func (q NatsService) ReceiveNotification() *NotificationQueueMessage

ReceiveNotification from the SQS queue for sending by the notifier

func (NatsService) SendImage

func (q NatsService) SendImage(imageName string, state string) (err error)

SendImage to the Nats queue for processing by the Inspector.

func (NatsService) SendNotification

func (q NatsService) SendNotification(notificationID uint) (err error)

SendNotification to the SQS queue for processing by the Notifier.

type NotificationQueueMessage

type NotificationQueueMessage struct {
	NotificationID uint `json:"NotificationID"`
	ReceiptHandle  *string
}

NotificationQueueMessage is sent to the queue to trigger a notification.

type Service

type Service interface {
	SendImage(imageName string, state string) (err error)
	ReceiveImage() *ImageQueueMessage
	DeleteImage(img *ImageQueueMessage) error
	SendNotification(notificationID uint) error
	ReceiveNotification() *NotificationQueueMessage
	DeleteNotification(notify *NotificationQueueMessage) error
}

Service interface so we can mock it out for tests TODO!! There must be a cleaner way that doesn't involve a different set of methods for each type of message

type SqsService

type SqsService struct {
	// contains filtered or unexported fields
}

SqsService for sending and receiving messages on SQS

func NewSqsService

func NewSqsService() SqsService

NewSqsService opens a new session with SQS

func (SqsService) DeleteImage

func (q SqsService) DeleteImage(img *ImageQueueMessage) error

DeleteImage from the queue once it has successfully been inspected.

func (SqsService) DeleteNotification

func (q SqsService) DeleteNotification(notification *NotificationQueueMessage) error

DeleteNotification from the queue once it has been sent.

func (SqsService) ReceiveImage

func (q SqsService) ReceiveImage() *ImageQueueMessage

ReceiveImage from the SQS queue for processing by the inspector.

func (SqsService) ReceiveNotification

func (q SqsService) ReceiveNotification() *NotificationQueueMessage

ReceiveNotification from the SQS queue for sending by the notifier

func (SqsService) SendImage

func (q SqsService) SendImage(imageName string, state string) (err error)

SendImage to the SQS queue for processing by the Inspector.

func (SqsService) SendNotification

func (q SqsService) SendNotification(notificationID uint) (err error)

SendNotification to the SQS queue for processing by the Notifier.

Jump to

Keyboard shortcuts

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