IProcessorStorageProvider.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Quadarax.Foundation.Core.Business.Processor.Enums;
  2. using Quadarax.Foundation.Core.Business.Processor.Task;
  3. using Quadarax.Foundation.Core.Data;
  4. using Quadarax.Foundation.Core.Object;
  5. namespace Quadarax.Foundation.Core.Business.Processor.Providers
  6. {
  7. public interface IProcessorStorageProvider : IDisposable
  8. {
  9. /// <summary>
  10. /// Open storage connection if needed
  11. /// </summary>
  12. public void Open();
  13. /// <summary>
  14. /// Close storage connection if needed
  15. /// </summary>
  16. public void Close();
  17. /// <summary>
  18. /// Ensure storage is ready to use. If not exists, create it.
  19. /// <description>This operation doesn't use Open or Close operation to access to storage and doesn't affects Open/Close state..</description>
  20. /// </summary>
  21. /// <returns>Returns true, if storage already exists. Otherwise returns false that storage was created.</returns>
  22. public bool EnsureStorage();
  23. /// <summary>
  24. /// Create new task item in storage and save it.
  25. /// </summary>
  26. /// <param name="item">Item to create.</param>
  27. /// <returns>Identifier of new created item.</returns>
  28. public ITaskIdentifier Create(ITaskItemData item);
  29. /// <summary>
  30. /// Get task item from storage by identifier.
  31. /// </summary>
  32. /// <param name="ids">Storage identifiers of Task item</param>
  33. /// <returns>Array of Task items</returns>
  34. public ITaskItemData[] Get(params ITaskIdentifier[] ids);
  35. /// <summary>
  36. /// Saves task items in storage.
  37. /// </summary>
  38. /// <param name="items">Task items to save.</param>
  39. public void Set(params ITaskItemData[] items);
  40. /// <summary>
  41. /// Deletes task items physically in storage.
  42. /// </summary>
  43. /// <param name="ids">Storage identifiers of Task item</param>
  44. public void Delete(params ITaskIdentifier[] ids);
  45. /// <summary>
  46. /// Query task items from storage by status.
  47. /// </summary>
  48. /// <param name="paging">Defines paging settings to apply in storage.</param>
  49. /// <param name="statuses">Allowed statuses</param>
  50. /// <returns>Queryable collection of selected Task items.</returns>
  51. public IQueryable<ITaskItemData> Query(IPaging paging, params ProcessStatusEnum[] statuses);
  52. }
  53. }