ЛР 5 — асинхронная обработка и версии pipeline

This commit is contained in:
2026-11-16 02:38:13 +03:00
parent 276dbdad8a
commit 1f535f1b5b
163 changed files with 17194 additions and 24 deletions
+36
View File
@@ -0,0 +1,36 @@
package repository
import (
"context"
"highload/internal/model"
"time"
)
type AttachmentRepository interface {
CreateAttachment(ctx context.Context, params CreateAttachmentParams) (*model.Attachment, error)
GetAttachmentForUser(ctx context.Context, userID, attachmentID string) (*model.Attachment, error)
ExistsByObjectKey(ctx context.Context, key string) (bool, error)
WithObjectKeyLock(ctx context.Context, key string, fn func(context.Context, AttachmentTx) error) (bool, error)
}
type AttachmentKey struct {
ID string
ObjectKey string
CreatedAt time.Time
}
type AttachmentReconcileRepository interface {
ListAttachmentKeys(ctx context.Context, afterKey string, pageSize int32) ([]AttachmentKey, error)
GetAttachmentByID(ctx context.Context, id string) (*model.Attachment, error)
WithObjectKeyLock(ctx context.Context, key string, fn func(context.Context, AttachmentTx) error) (bool, error)
}
type CreateAttachmentParams struct {
ChatID string
OwnerID string
Filename string
ObjectKey string
ContentType string
Sha256 string
SizeBytes int64
}