From 94352c6124aed2d85cfb21e83c0dafb6f918fb7d Mon Sep 17 00:00:00 2001 From: Nick White Date: Wed, 2 Oct 2019 12:32:59 +0100 Subject: Add wipeonly queue and functionality This is useful for prebinarised images, which don't need full preprocessing, but do require wiping, albeit with a more conservative threshold. --- bookpipeline/aws.go | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'bookpipeline/aws.go') diff --git a/bookpipeline/aws.go b/bookpipeline/aws.go index d4cd306..0127d6e 100644 --- a/bookpipeline/aws.go +++ b/bookpipeline/aws.go @@ -33,14 +33,14 @@ type AwsConn struct { Logger *log.Logger // these are used internally - sess *session.Session - ec2svc *ec2.EC2 - s3svc *s3.S3 - sqssvc *sqs.SQS - downloader *s3manager.Downloader - uploader *s3manager.Uploader - prequrl, ocrqurl, analysequrl string - wipstorageid string + sess *session.Session + ec2svc *ec2.EC2 + s3svc *s3.S3 + sqssvc *sqs.SQS + downloader *s3manager.Downloader + uploader *s3manager.Uploader + wipequrl, prequrl, ocrqurl, analysequrl string + wipstorageid string } // TODO: split this up, as not everything is needed for different uses @@ -74,6 +74,15 @@ func (a *AwsConn) Init() error { } a.prequrl = *result.QueueUrl + a.Logger.Println("Getting wipeonly queue URL") + result, err = a.sqssvc.GetQueueUrl(&sqs.GetQueueUrlInput{ + QueueName: aws.String("rescribewipeonly"), + }) + if err != nil { + return errors.New(fmt.Sprintf("Error getting wipeonly queue URL: %s", err)) + } + a.wipequrl = *result.QueueUrl + a.Logger.Println("Getting OCR queue URL") result, err = a.sqssvc.GetQueueUrl(&sqs.GetQueueUrlInput{ QueueName: aws.String("rescribeocr"), @@ -192,6 +201,10 @@ func (a *AwsConn) PreQueueId() string { return a.prequrl } +func (a *AwsConn) WipeQueueId() string { + return a.wipequrl +} + func (a *AwsConn) OCRQueueId() string { return a.ocrqurl } -- cgit v1.2.1-24-ge1ad