Files
mtusi2026lab5/internal/domain/keys.go
T
Vladislav Kunetskiy 01b885e846 lab5: очереди и асинхронная обработка изображений
Durable staging handoff, transactional outbox, at-least-once worker with lease fencing, idempotent versioned pipeline, three variants, operator tooling, contract tests and evidence. Includes the review fixes: reprocess source selection and failure settlement, replay guards, stale-job retirement, PNG structural/raster validation, migration rollback safety and audit events.
2026-10-31 14:34:24 +03:00

32 lines
947 B
Go

package domain
import (
"strconv"
"github.com/google/uuid"
)
const (
StagingUploadPrefix = "staging/uploads/"
StagingVerifiedPrefix = "staging/verified/"
StagingPresignPrefix = "staging/presign/"
AttachmentsPrefix = "attachments/"
)
func StagingUploadKey(chatID, attachmentID uuid.UUID) string {
return StagingUploadPrefix + chatID.String() + "/" + attachmentID.String()
}
func StagingVerifiedKey(chatID, attachmentID uuid.UUID) string {
return StagingVerifiedPrefix + chatID.String() + "/" + attachmentID.String()
}
func OriginalObjectKey(chatID, attachmentID uuid.UUID) string {
return AttachmentsPrefix + chatID.String() + "/" + attachmentID.String() + "/original"
}
func VariantObjectKey(chatID, attachmentID uuid.UUID, pipelineVersion int, name VariantName) string {
return AttachmentsPrefix + chatID.String() + "/" + attachmentID.String() +
"/variants/v" + strconv.Itoa(pipelineVersion) + "/" + name.ObjectName()
}