2026-06-26 08:37:04 +00:00
|
|
|
package repository
|
|
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
|
|
|
|
|
type QueueRepository interface {
|
|
|
|
|
Enqueue(ctx context.Context, workerType, jobID string) error
|
|
|
|
|
Dequeue(ctx context.Context, workerType string, timeoutSeconds int) (string, error)
|
|
|
|
|
RemoveJob(ctx context.Context, workerType, jobID string) error
|
2026-06-28 08:28:42 +00:00
|
|
|
RemoveOneJob(ctx context.Context, workerType, jobID string) error
|
2026-06-26 08:37:04 +00:00
|
|
|
SetCancelSignal(ctx context.Context, jobID, reason string) error
|
|
|
|
|
GetCancelSignal(ctx context.Context, jobID string) (bool, string, error)
|
|
|
|
|
ClearCancelSignal(ctx context.Context, jobID string) error
|
|
|
|
|
TryLock(ctx context.Context, jobID, workerID string, ttlSeconds int) (bool, error)
|
|
|
|
|
RefreshLock(ctx context.Context, jobID, workerID string, ttlSeconds int) error
|
|
|
|
|
ReleaseLock(ctx context.Context, jobID, workerID string) error
|
|
|
|
|
TryAcquireDedupe(ctx context.Context, templateType, dedupeHash, jobID string, ttlSeconds int) (bool, error)
|
|
|
|
|
ReleaseDedupe(ctx context.Context, templateType, dedupeHash string) error
|
|
|
|
|
TrySchedulerLock(ctx context.Context, holder string, ttlSeconds int) (bool, error)
|
|
|
|
|
ReleaseSchedulerLock(ctx context.Context, holder string) error
|
|
|
|
|
}
|