Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct {
// ID is a unique identifier for this item
ID string `json:"id"`
// Operation type: encrypt or decrypt
Operation OperationType `json:"operation"`
// SourcePath is the path to the source file
SourcePath string `json:"source_path"`
// DestPath is the path where the processed file should be saved
DestPath string `json:"dest_path"`
// KeyPath for the encryption key file
KeyPath string `json:"key_path,omitempty"`
// ChecksumPath for the checksum file
ChecksumPath string `json:"checksum_path,omitempty"`
// Status is the current status of this item
Status ItemStatus `json:"status"`
// AttemptCount is the number of times this item has been processed
AttemptCount int `json:"attempt_count"`
// LastAttempt is the timestamp of the last processing attempt
LastAttempt time.Time `json:"last_attempt"`
// NextRetry is when the next retry should occur
NextRetry time.Time `json:"next_retry,omitempty"`
// Error is the last error message
Error string `json:"error,omitempty"`
// CreatedAt is when this item was created
CreatedAt time.Time `json:"created_at"`
// CompletedAt is when this item was completed
CompletedAt time.Time `json:"completed_at,omitempty"`
// FileSize is the size of the source file in bytes
FileSize int64 `json:"file_size"`
// Checksum is the original file checksum
Checksum string `json:"checksum,omitempty"`
}
Item represents a work item in the processing queue.
func NewItem ¶
func NewItem(op OperationType, source, dest string) *Item
NewItem creates a new queue item.
func (*Item) MarkCompleted ¶
func (i *Item) MarkCompleted()
MarkCompleted marks the item as completed
func (*Item) MarkFailed ¶
MarkFailed updates the item's state after a failed processing attempt.
func (*Item) MarkProcessing ¶
func (i *Item) MarkProcessing()
MarkProcessing marks the item as being processed
func (*Item) ShouldRetry ¶
ShouldRetry determines if the item should be retried based on the max retries limit.
type ItemStatus ¶
type ItemStatus string
ItemStatus represents the status of a queue item
const ( StatusPending ItemStatus = "pending" StatusProcessing ItemStatus = "processing" StatusCompleted ItemStatus = "completed" StatusFailed ItemStatus = "failed" StatusDLQ ItemStatus = "dead_letter_queue" )
type OperationType ¶
type OperationType string
OperationType defines the type of operation to be performed on a file.
const ( // OperationEncrypt represents an encryption operation. OperationEncrypt OperationType = "encrypt" // OperationDecrypt represents a decryption operation. OperationDecrypt OperationType = "decrypt" )
Click to show internal directories.
Click to hide internal directories.