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 MoveCurToDLQ(root, agent, filename, originalID, failureReason, failureDetail 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 OpenRegularNoFollow(path string) (*os.File, os.FileInfo, error)
- func ReadRegularNoFollow(path string) ([]byte, error)
- func RetryFromDLQ(root, agent, dlqFilename string, force bool) error
- func SyncDir(dir string) error
- func ValidateHandle(agent string) error
- func ValidateMessageFilename(filename string) error
- func WriteFileAtomic(dir, filename string, data []byte, perm os.FileMode) (string, error)
- type DLQEnvelope
- type PartialDeliveryError
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 partial failure, committed deliveries remain in new/ and undelivered tmp files are removed.
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 MoveCurToDLQ ¶ added in v0.39.0
func MoveCurToDLQ(root, agent, filename, originalID, failureReason, failureDetail string) (string, error)
MoveCurToDLQ moves an already-claimed inbox/cur message to dlq/new.
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.
func OpenRegularNoFollow ¶ added in v0.40.0
OpenRegularNoFollow opens path only if it is a regular file and not a symlink.
func ReadRegularNoFollow ¶ added in v0.40.0
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.
func ValidateMessageFilename ¶ added in v0.40.0
ValidateMessageFilename validates an inbox or DLQ message filename.
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.
type PartialDeliveryError ¶ added in v0.39.0
type PartialDeliveryError struct {
Delivered map[string]string
Failed string
Pending []string
Err error
}
PartialDeliveryError reports the delivery state after a multi-recipient delivery fails during the tmp -> new commit phase.
func (*PartialDeliveryError) Error ¶ added in v0.39.0
func (e *PartialDeliveryError) Error() string
func (*PartialDeliveryError) Unwrap ¶ added in v0.39.0
func (e *PartialDeliveryError) Unwrap() error