fsq

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DLQSchemaVersion = "amq/dlq/v1"
	MaxRetries       = 3
)
View Source
const (
	BoxNew = "new"
	BoxCur = "cur"
)

Variables

This section is empty.

Functions

func AgentAcksReceived

func AgentAcksReceived(root, agent string) string

func AgentAcksSent

func AgentAcksSent(root, agent string) string

func AgentBase

func AgentBase(root, agent string) string

func AgentDLQCur added in v0.9.0

func AgentDLQCur(root, agent string) string

func AgentDLQNew added in v0.9.0

func AgentDLQNew(root, agent string) string

func AgentDLQTmp added in v0.9.0

func AgentDLQTmp(root, agent string) string

func AgentInboxCur

func AgentInboxCur(root, agent string) string

func AgentInboxNew

func AgentInboxNew(root, agent string) string

func AgentInboxTmp

func AgentInboxTmp(root, agent string) string

func AgentOutboxSent

func AgentOutboxSent(root, agent string) string

func DeliverToInbox

func DeliverToInbox(root, agent, filename string, data []byte) (string, error)

DeliverToInbox writes a message using Maildir semantics (tmp -> new). It returns the final path in inbox/new.

func DeliverToInboxes added in v0.2.0

func DeliverToInboxes(root string, recipients []string, filename string, data []byte) (map[string]string, error)

DeliverToInboxes writes a message to multiple inboxes. On failure, it attempts to roll back any prior deliveries.

func EnsureAgentDirs

func EnsureAgentDirs(root, agent string) error

func EnsureRootDirs

func EnsureRootDirs(root string) error

func FindDLQMessage added in v0.9.0

func FindDLQMessage(root, agent, filename string) (string, string, error)

FindDLQMessage locates a DLQ message in dlq/new or dlq/cur.

func FindMessage

func FindMessage(root, agent, filename string) (string, string, error)

func FindTmpFilesOlderThan

func FindTmpFilesOlderThan(root string, cutoff time.Time) ([]string, error)

func GenerateDLQID added in v0.9.0

func GenerateDLQID() string

GenerateDLQID creates a unique ID for a DLQ envelope.

func ListAgents

func ListAgents(root string) ([]string, error)

func MoveDLQNewToCur added in v0.9.0

func MoveDLQNewToCur(root, agent, filename string) error

MoveDLQNewToCur moves a DLQ message from new to cur (marks as inspected).

func MoveNewToCur

func MoveNewToCur(root, agent, filename string) error

func MoveToDLQ added in v0.9.0

func MoveToDLQ(root, agent, filename, originalID, failureReason, failureDetail string) (string, error)

MoveToDLQ moves a failed message from inbox/new to dlq/new with envelope. Uses atomic rename when possible to prevent duplicates on cleanup failure.

func RetryFromDLQ added in v0.9.0

func RetryFromDLQ(root, agent, dlqFilename string, force bool) error

RetryFromDLQ moves a message from DLQ back to inbox/new for reprocessing. Returns error if retry_count >= MaxRetries and force is false.

func SyncDir

func SyncDir(dir string) error

SyncDir fsyncs a directory to ensure directory entries are durable.

func WriteFileAtomic

func WriteFileAtomic(dir, filename string, data []byte, perm os.FileMode) (string, error)

WriteFileAtomic writes data to a temporary file in dir and renames it into place.

Types

type DLQEnvelope added in v0.9.0

type DLQEnvelope struct {
	Schema        string `json:"schema"`
	ID            string `json:"id"`
	OriginalID    string `json:"original_id"`
	OriginalFile  string `json:"original_file"`
	FailureReason string `json:"failure_reason"`
	FailureDetail string `json:"failure_detail"`
	FailureTime   string `json:"failure_time"`
	RetryCount    int    `json:"retry_count"`
	SourceDir     string `json:"source_dir"`
}

DLQEnvelope wraps a failed message with failure metadata.

func ReadDLQEnvelope added in v0.9.0

func ReadDLQEnvelope(path string) (*DLQEnvelope, []byte, error)

ReadDLQEnvelope reads and parses a DLQ message.

Jump to

Keyboard shortcuts

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