annotate Implab/IPromise.cs @ 99:8ddf1648eca4 v2

fixed TransientPromiseException handling
author cin
date Wed, 05 Nov 2014 02:31:35 +0300
parents daffa72a1cec
children 279e226dffdd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
1 using System;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
2 using System.Collections.Generic;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
3 using System.Linq;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
4 using System.Text;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
5
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
6 namespace Implab {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
7 public interface IPromise: ICancellable {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
8 /// <summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
9 /// Check whereather the promise has no more than one dependent promise.
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
10 /// </summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
11 bool IsExclusive {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
12 get;
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
13 }
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
14
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
15 /// <summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
16 /// Тип результата, получаемого через данное обещание.
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
17 /// </summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
18 Type PromiseType { get; }
25
9bf5b23650c9 refactoring
cin
parents: 19
diff changeset
19
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
20 /// <summary>
99
8ddf1648eca4 fixed TransientPromiseException handling
cin
parents: 96
diff changeset
21 /// Обещание является выполненым, либо успешно, либо с ошибкой, либо отменено.
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
22 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
23 bool IsResolved { get; }
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
24
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
25 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
26 /// Обещание было отменено.
c4140283575c minor fixes
cin
parents: 66
diff changeset
27 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
28 bool IsCancelled { get; }
25
9bf5b23650c9 refactoring
cin
parents: 19
diff changeset
29
75
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
30 IPromise Then(Action success, ErrorHandler error, Action cancel);
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
31 IPromise Then(Action success, ErrorHandler error);
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
32 IPromise Then(Action success);
75
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
33
96
daffa72a1cec Added the chaining method to the non-generic IPromise
cin
parents: 76
diff changeset
34 IPromise Chain(Func<IPromise> chained, ErrorHandler<IPromise> error, Action cancel);
daffa72a1cec Added the chaining method to the non-generic IPromise
cin
parents: 76
diff changeset
35 IPromise Chain(Func<IPromise> chained, ErrorHandler<IPromise> error);
daffa72a1cec Added the chaining method to the non-generic IPromise
cin
parents: 76
diff changeset
36 IPromise Chain(Func<IPromise> chained);
daffa72a1cec Added the chaining method to the non-generic IPromise
cin
parents: 76
diff changeset
37
75
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
38 /// <summary>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
39 /// Добавляет последнй обработчик в цепочку обещаний, не создает промежуточных обещаний.
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
40 /// </summary>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
41 /// <param name="success">Success.</param>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
42 /// <param name="error">Error.</param>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
43 /// <param name="cancel">Cancel.</param>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
44 void Last(Action success, ErrorHandler error, Action cancel);
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
45 void Last(Action success, ErrorHandler error);
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
46 void Last(Action success);
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
47
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
48 IPromise Error(ErrorHandler error);
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
49 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
50 /// Обрабатывает либо ошибку, либо результат. Событие отмены не обрабатывается.
c4140283575c minor fixes
cin
parents: 66
diff changeset
51 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
52 /// <param name="handler">Обработчик.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
53 /// <remarks>После обработке ошибки, она передается дальше.</remarks>
c4140283575c minor fixes
cin
parents: 66
diff changeset
54 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
55 /// Обрабатывает либо ошибку, либо результат, либо отмену обещания.
c4140283575c minor fixes
cin
parents: 66
diff changeset
56 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
57 /// <param name="handler">Обработчик.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
58 /// <remarks>После обработке ошибки, она передается дальше.</remarks>
76
c761fc982e1d Refactoring of the IPromise<T> interface
cin
parents: 75
diff changeset
59 IPromise Anyway(Action handler);
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
60 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
61 /// Обработчик для регистрации отмены обещания, событие отмены не может быть подавлено.
c4140283575c minor fixes
cin
parents: 66
diff changeset
62 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
63 /// <returns>Новое обещание, связанное с текущим.</returns>
c4140283575c minor fixes
cin
parents: 66
diff changeset
64 /// <param name="handler">Обработчик события.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
65 /// <remarks>Если обработчик вызывает исключение, то оно передается обработчику ошибки, результат работы
c4140283575c minor fixes
cin
parents: 66
diff changeset
66 /// которого будет передан связанному обещанию</remarks>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
67 IPromise Cancelled(Action handler);
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
68
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
69 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
70 /// Преобразует результат обещания к заданному типу и возвращает новое обещание.
c4140283575c minor fixes
cin
parents: 66
diff changeset
71 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
72 IPromise<T> Cast<T>();
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
73
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
74 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
75 /// Синхронизирует текущий поток с обещанием.
c4140283575c minor fixes
cin
parents: 66
diff changeset
76 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
77 void Join();
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
78 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
79 /// Синхронизирует текущий поток с обещанием.
c4140283575c minor fixes
cin
parents: 66
diff changeset
80 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
81 /// <param name="timeout">Время ожидания, по его истечению возникнет исключение.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
82 /// <exception cref="TimeoutException">Превышено время ожидания.</exception>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
83 void Join(int timeout);
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
84
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
85 }
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
86 }