You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel/Services/Shedulling/ISheduller.cs

101 lines
4.2 KiB

6 years ago
using System;
namespace ZeroLevel.Services.Shedulling
{
public interface ISheduller : IDisposable
{
DateTime this[long index] { get; }
6 years ago
#region One time events
6 years ago
long RemindAfter(TimeSpan timespan, Action<long> callback);
6 years ago
long RemindAt(DateTime date, Action<long> callback);
#endregion One time events
6 years ago
#region Repitable behaviour
6 years ago
/// <summary>
/// Performs an action once a period, while the period is recalculated according to the transferred function at each re-creation of the task.
6 years ago
/// </summary>
/// <param name="nextEventPeriodCalcFunction">Function to calculate the next period</param>
/// <param name="callback">Action</param>
/// <returns>Task ID</returns>
6 years ago
long RemindEveryNonlinearPeriod(Func<TimeSpan> nextEventPeriodCalcFunction, Action<long> callback,
bool breakWherError = false);
6 years ago
/// <summary>
/// Performs an action once a period, while the period is recalculated according to the transferred function at each re-creation of the task.
6 years ago
/// </summary>
/// <param name="firstEventPeriodCalcFunction">The function to calculate the period to the first execution</param>
/// <param name="nextEventPeriodCalcFunction">The function for calculating the period until subsequent performances</param>
/// <param name="callback">Action</param>
/// <returns>Task ID</returns>
6 years ago
long RemindEveryNonlinearPeriod(Func<TimeSpan> firstEventPeriodCalcFunction,
Func<TimeSpan> nextEventPeriodCalcFunction, Action<long> callback,
bool breakWherError = false);
6 years ago
/// <summary>
/// Performs an action once per period, while the date is recalculated from the function transferred each time the task is recreated.
6 years ago
/// </summary>
/// <param name="nextEventDateCalcFunction">The function to calculate the next date</param>
/// <param name="callback">Action</param>
/// <returns>Task ID</returns>
6 years ago
long RemindEveryNonlinearDate(Func<DateTime, DateTime> nextEventDateCalcFunction, Action<long> callback,
bool breakWherError = false);
long RemindEveryNonlinearDate(DateTime firstTime, Func<DateTime, DateTime> nextEventDateCalcFunction,
Action<long> callback,
bool breakWherError = false);
6 years ago
/// <summary>
/// Performs an action once per period, while the date is recalculated from the function transferred each time the task is recreated.
6 years ago
/// </summary>
/// <param name="firstEventDateCalcFunction">The function to calculate the first run date</param>
/// <param name="nextEventDateCalcFunction">The function to calculate the next date</param>
/// <param name="callback">Action</param>
/// <returns>Task ID</returns>
6 years ago
long RemindEveryNonlinearDate(Func<DateTime, DateTime> firstEventDateCalcFunction,
Func<DateTime, DateTime> nextEventDateCalcFunction, Action<long> callback,
bool breakWherError = false);
6 years ago
/// <summary>
/// Performs an action once in a specified period
6 years ago
/// </summary>
/// <param name="timespan">Period</param>
/// <param name="callback">Action</param>
/// <returns>Task ID</returns>
6 years ago
long RemindEvery(TimeSpan timespan, Action<long> callback,
bool breakWherError = false);
6 years ago
/// <summary>
/// Performs an action once in a specified period
6 years ago
/// </summary>
/// <param name="first">Period to first run</param>
/// <param name="next">Period</param>
/// <param name="callback">Action</param>
/// <returns>Task ID</returns>
6 years ago
long RemindEvery(TimeSpan first, TimeSpan next, Action<long> callback,
bool breakWherError = false);
7 months ago
long RemindWhile(TimeSpan period, Func<long, bool> callback, Action continueWith = null!,
6 years ago
bool breakWherError = false);
#endregion Repitable behaviour
6 years ago
#region Sheduller control
6 years ago
void Pause();
6 years ago
void Resume();
6 years ago
void Clean();
6 years ago
bool Remove(long key);
5 years ago
void SetInitialIndex(long index);
#endregion Sheduller control
6 years ago
}
}

Powered by TurnKey Linux.