recipientsRepository

package
v0.0.0-...-fbe4437 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndividualJobStatus

type IndividualJobStatus struct {
	Status                        string
	Message                       string
	NumberOfRecipients            int
	NumberOfSentMails             int
	NumberOfSendingFailures       int
	NumberOfCurrentlySendingMails int64
}

type JobStatus

type JobStatus struct {
	Jobs    map[string]IndividualJobStatus
	Summary IndividualJobStatus
}

type LeaseExtensionRepository

type LeaseExtensionRepository interface {
	/*
	 * Extends the lease of the given already popped recipient.
	 */
	ExtendLease(jobId, recipient string) error
}

type LinkTemplate

type LinkTemplate struct {
	EncryptionKey string
	BaseLink      string
	Parameters    []string
}

type LoggingDummyRepository

type LoggingDummyRepository struct {
	// storage to use after logging
	Repository Repository
}

func (*LoggingDummyRepository) AbortAndRemoveJob

func (this *LoggingDummyRepository) AbortAndRemoveJob(jobId string) error

func (*LoggingDummyRepository) AddRecipient

func (this *LoggingDummyRepository) AddRecipient(jobId, recipient string) error

func (*LoggingDummyRepository) CreateJob

func (this *LoggingDummyRepository) CreateJob(jobId string, htmlTemplate string) error

func (*LoggingDummyRepository) ExtendLease

func (this *LoggingDummyRepository) ExtendLease(jobId, recipient string) error

func (*LoggingDummyRepository) FinishPreparation

func (this *LoggingDummyRepository) FinishPreparation(jobId string, numberOfRecipients int) error

func (*LoggingDummyRepository) GetJobStatus

func (this *LoggingDummyRepository) GetJobStatus(jobIds []string) (status JobStatus, err error)

func (*LoggingDummyRepository) GetNextOpenRecipient

func (this *LoggingDummyRepository) GetNextOpenRecipient(jobId string) (recipient string, err error)

func (*LoggingDummyRepository) GetRandomOpenJob

func (this *LoggingDummyRepository) GetRandomOpenJob() (jobId string, err error)

func (*LoggingDummyRepository) GetTemplates

func (this *LoggingDummyRepository) GetTemplates(jobId string) (templates Templates, err error)

func (*LoggingDummyRepository) MarkJobAsFailed

func (this *LoggingDummyRepository) MarkJobAsFailed(jobId, reason string) error

func (*LoggingDummyRepository) MarkRecipientAsDone

func (this *LoggingDummyRepository) MarkRecipientAsDone(jobId, recipient string) error

func (*LoggingDummyRepository) MarkRecipientAsFailed

func (this *LoggingDummyRepository) MarkRecipientAsFailed(jobId, recipient, recipientId string, cause error) error

func (*LoggingDummyRepository) WriteSendingFailuresToFile

func (this *LoggingDummyRepository) WriteSendingFailuresToFile(targetFile string, jobIds []string) (err error)

type MailSendingFailure

type MailSendingFailure struct {
	Recipient string
	Cause     string
}

type RedisRepository

type RedisRepository struct {
	Pool *redis.Pool
}

func (*RedisRepository) AbortAndRemoveJob

func (this *RedisRepository) AbortAndRemoveJob(jobId string) error

func (*RedisRepository) AddRecipient

func (this *RedisRepository) AddRecipient(jobId, recipient string) error

func (*RedisRepository) CreateJob

func (this *RedisRepository) CreateJob(jobId string, htmlTemplate string) error

func (*RedisRepository) ExtendLease

func (this *RedisRepository) ExtendLease(jobId, recipient string) error

func (*RedisRepository) FinishPreparation

func (this *RedisRepository) FinishPreparation(jobId string, numberOfRecipients int) error

func (*RedisRepository) GetJobStatus

func (this *RedisRepository) GetJobStatus(jobIds []string) (status JobStatus, err error)

func (*RedisRepository) GetNextOpenRecipient

func (this *RedisRepository) GetNextOpenRecipient(jobId string) (recipient string, err error)

func (*RedisRepository) GetRandomOpenJob

func (this *RedisRepository) GetRandomOpenJob() (jobId string, err error)

func (*RedisRepository) GetTemplates

func (this *RedisRepository) GetTemplates(jobId string) (templates Templates, err error)

func (*RedisRepository) MarkJobAsFailed

func (this *RedisRepository) MarkJobAsFailed(jobId, reason string) error

func (*RedisRepository) MarkRecipientAsDone

func (this *RedisRepository) MarkRecipientAsDone(jobId, recipient string) error

func (*RedisRepository) MarkRecipientAsFailed

func (this *RedisRepository) MarkRecipientAsFailed(jobId, recipient, recipientId string, cause error) error

func (*RedisRepository) WriteSendingFailuresToFile

func (this *RedisRepository) WriteSendingFailuresToFile(targetFile string, jobIds []string) (err error)

type Repository

type Repository interface {
	LeaseExtensionRepository

	GetRandomOpenJob() (jobId string, err error)

	/*
	 * Creates a new job with the given jobId or returns an
	 * error if this job already exists.
	 */
	CreateJob(jobId string, templates string) error

	AbortAndRemoveJob(jobId string) error

	GetJobStatus(jobIds []string) (status JobStatus, err error)

	WriteSendingFailuresToFile(targetFile string, jobIds []string) (err error)

	/**
	 * marks the job as fully prepared and sets the total number of recipients
	 */
	FinishPreparation(jobId string, numberOfRecipients int) error

	MarkJobAsFailed(jobId, reason string) error

	AddRecipient(jobId, recipient string) error

	/*
	 * Pops the next remaining recipient for the given job id.
	 *
	 * see ExtendLease
	 * see RemoveRemaining
	 */
	GetNextOpenRecipient(jobId string) (recipient string, err error)

	MarkRecipientAsDone(jobId, recipient string) error

	MarkRecipientAsFailed(jobId, recipient, recipientId string, cause error) error

	GetTemplates(jobId string) (templates Templates, err error)
}

type RepositoryError

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

func (*RepositoryError) Error

func (this *RepositoryError) Error() string

type Templates

type Templates struct {
	SubjectTemplate *template.Template
	BodyTemplate    *template.Template

	ReceiverEmailTemplate *template.Template
	ReceiverNameTemplate  *template.Template

	SenderEmailTemplate *template.Template
	SenderNameTemplate  *template.Template

	ReplyToEmailTemplate *template.Template

	LinkTemplates map[string]LinkTemplate
}

type TemplatesString

type TemplatesString struct {
	SubjectTemplate string
	BodyTemplate    string

	ReceiverEmailTemplate string
	ReceiverNameTemplate  string

	SenderEmailTemplate string
	SenderNameTemplate  string

	ReplyToEmailTemplate string

	LinkTemplates map[string]LinkTemplate
}

func (*TemplatesString) Parse

func (this *TemplatesString) Parse() (templates Templates, err error)

Jump to

Keyboard shortcuts

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