| | | 1 | | using Anichron.Core.Domain; |
| | | 2 | | |
| | | 3 | | namespace Anichron.Core.Work; |
| | | 4 | | |
| | | 5 | | public interface IWorkPayload |
| | | 6 | | { |
| | | 7 | | static abstract WorkKind Kind { get; } |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Coalesces requests: while an item with this key is queued, enqueueing another returns it. |
| | | 11 | | /// Null, the default, keeps every request a separate item. |
| | | 12 | | /// </summary> |
| | 6 | 13 | | string? DedupKey => null; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// The storage config the work is scoped to, or null for work any Worker may run. A per-user |
| | | 17 | | /// Worker claims only its user's configs and unscoped work. |
| | | 18 | | /// </summary> |
| | 24 | 19 | | Guid? StorageConfigId => null; |
| | | 20 | | } |
| | | 21 | | |
| | | 22 | | /// <summary>Work that runs once per storage config, periodically for every config a Worker serves.</summary> |
| | | 23 | | /// <typeparam name="TSelf">The payload type itself.</typeparam> |
| | | 24 | | public interface IStorageConfigPayload<out TSelf> : IWorkPayload |
| | | 25 | | where TSelf : IStorageConfigPayload<TSelf> |
| | | 26 | | { |
| | | 27 | | static abstract TSelf For(Guid storageConfigId); |
| | | 28 | | } |