forked from mtusi2026/mtusi2026lab5
ЛР 5 — асинхронная обработка и версии pipeline
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user