lab5: асинхронная очередь, worker и идемпотентный pipeline

API принимает 202 после durable staging и TX intent (job+outbox); отдельные relay и worker публикуют/обрабатывают задания с publisher confirm, lease, retry/backoff, DLQ и replay. Добавлены версии pipeline, варианты thumbnail/crop/optimized, presign в verified staging, status-aware sweeper и admission control.
This commit is contained in:
Vladislav Kunetskiy
2026-10-30 22:36:52 +03:00
parent 6c5ba026f1
commit 4bdcac3dfa
95 changed files with 8466 additions and 764 deletions
@@ -200,54 +200,61 @@ func (_c *MockAttachmentService_Get_Call) RunAndReturn(run func(ctx context.Cont
return _c
}
// Open provides a mock function for the type MockAttachmentService
func (_mock *MockAttachmentService) Open(ctx context.Context, callerID uuid.UUID, id uuid.UUID) (domain.Attachment, io.ReadCloser, error) {
ret := _mock.Called(ctx, callerID, id)
// OpenVariant provides a mock function for the type MockAttachmentService
func (_mock *MockAttachmentService) OpenVariant(ctx context.Context, callerID uuid.UUID, id uuid.UUID, name domain.VariantName) (domain.Attachment, domain.Variant, io.ReadCloser, error) {
ret := _mock.Called(ctx, callerID, id, name)
if len(ret) == 0 {
panic("no return value specified for Open")
panic("no return value specified for OpenVariant")
}
var r0 domain.Attachment
var r1 io.ReadCloser
var r2 error
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) (domain.Attachment, io.ReadCloser, error)); ok {
return returnFunc(ctx, callerID, id)
var r1 domain.Variant
var r2 io.ReadCloser
var r3 error
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) (domain.Attachment, domain.Variant, io.ReadCloser, error)); ok {
return returnFunc(ctx, callerID, id, name)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) domain.Attachment); ok {
r0 = returnFunc(ctx, callerID, id)
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) domain.Attachment); ok {
r0 = returnFunc(ctx, callerID, id, name)
} else {
r0 = ret.Get(0).(domain.Attachment)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID) io.ReadCloser); ok {
r1 = returnFunc(ctx, callerID, id)
if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) domain.Variant); ok {
r1 = returnFunc(ctx, callerID, id, name)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(io.ReadCloser)
r1 = ret.Get(1).(domain.Variant)
}
if returnFunc, ok := ret.Get(2).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) io.ReadCloser); ok {
r2 = returnFunc(ctx, callerID, id, name)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(io.ReadCloser)
}
}
if returnFunc, ok := ret.Get(2).(func(context.Context, uuid.UUID, uuid.UUID) error); ok {
r2 = returnFunc(ctx, callerID, id)
if returnFunc, ok := ret.Get(3).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) error); ok {
r3 = returnFunc(ctx, callerID, id, name)
} else {
r2 = ret.Error(2)
r3 = ret.Error(3)
}
return r0, r1, r2
return r0, r1, r2, r3
}
// MockAttachmentService_Open_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Open'
type MockAttachmentService_Open_Call struct {
// MockAttachmentService_OpenVariant_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OpenVariant'
type MockAttachmentService_OpenVariant_Call struct {
*mock.Call
}
// Open is a helper method to define mock.On call
// OpenVariant is a helper method to define mock.On call
// - ctx context.Context
// - callerID uuid.UUID
// - id uuid.UUID
func (_e *MockAttachmentService_Expecter) Open(ctx any, callerID any, id any) *MockAttachmentService_Open_Call {
return &MockAttachmentService_Open_Call{Call: _e.mock.On("Open", ctx, callerID, id)}
// - name domain.VariantName
func (_e *MockAttachmentService_Expecter) OpenVariant(ctx any, callerID any, id any, name any) *MockAttachmentService_OpenVariant_Call {
return &MockAttachmentService_OpenVariant_Call{Call: _e.mock.On("OpenVariant", ctx, callerID, id, name)}
}
func (_c *MockAttachmentService_Open_Call) Run(run func(ctx context.Context, callerID uuid.UUID, id uuid.UUID)) *MockAttachmentService_Open_Call {
func (_c *MockAttachmentService_OpenVariant_Call) Run(run func(ctx context.Context, callerID uuid.UUID, id uuid.UUID, name domain.VariantName)) *MockAttachmentService_OpenVariant_Call {
_c.Call.Run(func(args mock.Arguments) {
var arg0 context.Context
if args[0] != nil {
@@ -261,21 +268,26 @@ func (_c *MockAttachmentService_Open_Call) Run(run func(ctx context.Context, cal
if args[2] != nil {
arg2 = args[2].(uuid.UUID)
}
var arg3 domain.VariantName
if args[3] != nil {
arg3 = args[3].(domain.VariantName)
}
run(
arg0,
arg1,
arg2,
arg3,
)
})
return _c
}
func (_c *MockAttachmentService_Open_Call) Return(attachment domain.Attachment, readCloser io.ReadCloser, err error) *MockAttachmentService_Open_Call {
_c.Call.Return(attachment, readCloser, err)
func (_c *MockAttachmentService_OpenVariant_Call) Return(attachment domain.Attachment, variant domain.Variant, readCloser io.ReadCloser, err error) *MockAttachmentService_OpenVariant_Call {
_c.Call.Return(attachment, variant, readCloser, err)
return _c
}
func (_c *MockAttachmentService_Open_Call) RunAndReturn(run func(ctx context.Context, callerID uuid.UUID, id uuid.UUID) (domain.Attachment, io.ReadCloser, error)) *MockAttachmentService_Open_Call {
func (_c *MockAttachmentService_OpenVariant_Call) RunAndReturn(run func(ctx context.Context, callerID uuid.UUID, id uuid.UUID, name domain.VariantName) (domain.Attachment, domain.Variant, io.ReadCloser, error)) *MockAttachmentService_OpenVariant_Call {
_c.Call.Return(run)
return _c
}