annotate Implab/IDeferred.cs @ 243:b1e0ffdf3451 v3

working on promises
author cin
date Wed, 24 Jan 2018 19:24:10 +0300
parents fa6cbf4d8841
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
119
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
1 using System;
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
2
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
3 namespace Implab {
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
4 /// <summary>
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
5 /// Deferred result, usually used by asynchronous services as the service part of the promise.
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
6 /// </summary>
240
fa6cbf4d8841 refactoring, moving to dotnercore, simplifying promises
cin
parents: 145
diff changeset
7 public interface IDeferred {
119
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
8
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
9 void Resolve();
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
10
138
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
11 /// <summary>
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
12 /// Reject the promise with the specified error.
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
13 /// </summary>
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
14 /// <param name="error">The reason why the promise is rejected.</param>
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
15 /// <remarks>
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
16 /// Some exceptions are treated in a special case:
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
17 /// <see cref="OperationCanceledException"/> is interpreted as call to <see cref="Cancel()"/> method,
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
18 /// and <see cref="PromiseTransientException"/> is always unwrapped and its
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
19 /// <see cref="PromiseTransientException.InnerException"> is used as the reason to reject promise.
f75cfa58e3d4 added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
cin
parents: 119
diff changeset
20 /// </remarks>
119
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
21 void Reject(Exception error);
240
fa6cbf4d8841 refactoring, moving to dotnercore, simplifying promises
cin
parents: 145
diff changeset
22
fa6cbf4d8841 refactoring, moving to dotnercore, simplifying promises
cin
parents: 145
diff changeset
23 /// <summary>
fa6cbf4d8841 refactoring, moving to dotnercore, simplifying promises
cin
parents: 145
diff changeset
24 /// Marks current instance as cencelled with the specified reason.
fa6cbf4d8841 refactoring, moving to dotnercore, simplifying promises
cin
parents: 145
diff changeset
25 /// </summary>
fa6cbf4d8841 refactoring, moving to dotnercore, simplifying promises
cin
parents: 145
diff changeset
26 /// <param name="reason">The reason for the operation cancellation,
fa6cbf4d8841 refactoring, moving to dotnercore, simplifying promises
cin
parents: 145
diff changeset
27 /// if not specified the new <see cref="OperationCanceledException"> will be created</param>
fa6cbf4d8841 refactoring, moving to dotnercore, simplifying promises
cin
parents: 145
diff changeset
28 void SetCancelled(Exception reason);
119
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
29 }
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
30 }
2573b562e328 Promises rewritten, added improved version of AsyncQueue
cin
parents:
diff changeset
31