sendrecorder

package
v3.11.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SendEntryExpiry = 30 * time.Minute

Variables

This section is empty.

Functions

func GetMessageHash

func GetMessageHash(b []byte) (string, error)

GetMessageHash returns the hash of the given message. This takes into account: - the Subject header, - the From/To/Cc headers, - the Content-Type header of each (leaf) part, - the Content-Disposition header of each (leaf) part, - the (decoded) body of each part.

Types

type ID

type ID uint64

type SendRecorder

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

func NewSendRecorder

func NewSendRecorder(expiry time.Duration) *SendRecorder

func (*SendRecorder) HasEntryWait

func (h *SendRecorder) HasEntryWait(ctx context.Context,
	hash string,
	deadline time.Time,
	toList []string,
) (string, bool, error)

HasEntryWait returns whether the given message already exists in the send recorder. If it does, it waits for its ID to be known, then returns it and true. If no entry exists, or it times out while waiting for its ID to be known, it returns false.

func (*SendRecorder) RemoveOnFail

func (h *SendRecorder) RemoveOnFail(hash string, id ID)

func (*SendRecorder) SignalMessageSent

func (h *SendRecorder) SignalMessageSent(hash string, srID ID, msgID string)

SignalMessageSent should be called after a message has been successfully sent.

func (*SendRecorder) TryInsert

func (h *SendRecorder) TryInsert(hash string, toList []string) (ID, <-chan struct{}, bool)

func (*SendRecorder) TryInsertWait

func (h *SendRecorder) TryInsertWait(
	ctx context.Context,
	hash string,
	toList []string,
	deadline time.Time,
) (ID, bool, error)

TryInsertWait tries to insert the given message into the send recorder. If an entry already exists but it was not sent yet, it waits. It returns whether an entry could be inserted and an error if it times out while waiting.

Jump to

Keyboard shortcuts

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