Example #1
0
        /// <summary>
        /// Saves the state of the system to a store.
        /// </summary>
        /// <param name="this">System whose state will be saved.</param>
        /// <param name="writer">Writer to save state to.</param>
        /// <param name="progress">Progress indicator reporting progress percentages.</param>
        /// <returns>Task to observe the eventual completion of the operation.</returns>
        public static Task CheckpointAsync(this ICheckpointable @this, IStateWriter writer, IProgress <int> progress)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }

            return(@this.CheckpointAsync(writer, CancellationToken.None, progress));
        }
Example #2
0
        /// <summary>
        /// Recovers the state of the system from a store.
        /// </summary>
        /// <param name="this">System whose state will be loaded.</param>
        /// <param name="reader">Reader to load state from.</param>
        /// <param name="token">Cancellation token to observe cancellation requests.</param>
        /// <returns>Task to observe the eventual completion of the operation.</returns>
        public static Task RecoverAsync(this ICheckpointable @this, IStateReader reader, CancellationToken token)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }

            return(@this.RecoverAsync(reader, token, progress: null));
        }
Example #3
0
        /// <summary>
        /// Unloads the system.
        /// </summary>
        /// <param name="this">System that will be unloaded.</param>
        /// <returns>Task to observe the eventual completion of the operation.</returns>
        public static Task UnloadAsync(this ICheckpointable @this)
        {
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }

            return(@this.UnloadAsync(progress: null));
        }