Documentation
¶
Index ¶
- Constants
- func AgentBase(root, agent string) string
- func AgentDLQCur(root, agent string) string
- func AgentDLQNew(root, agent string) string
- func AgentDLQTmp(root, agent string) string
- func AgentInboxCur(root, agent string) string
- func AgentInboxNew(root, agent string) string
- func AgentInboxTmp(root, agent string) string
- func AgentOutboxSent(root, agent string) string
- func AgentReceipts(root, agent string) string
- func DeliverToExistingInbox(root, agent, filename string, data []byte) (string, error)
- func DeliverToInbox(root, agent, filename string, data []byte) (string, error)
- func DeliverToInboxes(root string, recipients []string, filename string, data []byte) (map[string]string, error)
- func EnsureAgentDirs(root, agent string) error
- func EnsureRootDirs(root string) error
- func FindDLQMessage(root, agent, filename string) (string, string, error)
- func FindMessage(root, agent, filename string) (string, string, error)
- func FindTmpFilesOlderThan(root string, cutoff time.Time) ([]string, error)
- func GenerateDLQID() string
- func ListAgents(root string) ([]string, error)
- func MoveDLQNewToCur(root, agent, filename string) error
- func MoveNewToCur(root, agent, filename string) error
- func MoveToDLQ(root, agent, filename, originalID, failureReason, failureDetail string) (string, error)
- func RetryFromDLQ(root, agent, dlqFilename string, force bool) error
- func SyncDir(dir string) error
- func ValidateHandle(agent string) error
- func WriteFileAtomic(dir, filename string, data []byte, perm os.FileMode) (string, error)
- type DLQEnvelope
Constants ¶
const ( DLQSchemaVersion = "amq/dlq/v1" MaxRetries = 3 )
const ( BoxNew = "new" BoxCur = "cur" )
Variables ¶
This section is empty.
Functions ¶
func AgentDLQCur ¶ added in v0.9.0
func AgentDLQNew ¶ added in v0.9.0
func AgentDLQTmp ¶ added in v0.9.0
func AgentInboxCur ¶
func AgentInboxNew ¶
func AgentInboxTmp ¶
func AgentOutboxSent ¶
func AgentReceipts ¶ added in v0.31.0
func DeliverToExistingInbox ¶ added in v0.24.0
DeliverToExistingInbox delivers a message to a foreign root's inbox using Maildir semantics (tmp -> new). Unlike DeliverToInboxes, it never creates directories — the target inbox must already exist. This prevents a sender from accidentally scaffolding structure in a peer project.
func DeliverToInbox ¶
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 EnsureRootDirs ¶
func FindDLQMessage ¶ added in v0.9.0
FindDLQMessage locates a DLQ message in dlq/new or dlq/cur.
func FindTmpFilesOlderThan ¶
func GenerateDLQID ¶ added in v0.9.0
func GenerateDLQID() string
GenerateDLQID creates a unique ID for a DLQ envelope.
func ListAgents ¶
func MoveDLQNewToCur ¶ added in v0.9.0
MoveDLQNewToCur moves a DLQ message from new to cur (marks as inspected).
func MoveNewToCur ¶
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
RetryFromDLQ moves a message from DLQ back to inbox/new for reprocessing. Returns error if retry_count >= MaxRetries and force is false.
func ValidateHandle ¶ added in v0.16.0
ValidateHandle returns an error if the agent handle contains path traversal characters or does not match the allowed pattern.
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.