-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathClusterResponseEventArgs.cs
More file actions
61 lines (54 loc) · 1.53 KB
/
ClusterResponseEventArgs.cs
File metadata and controls
61 lines (54 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using System.Threading.Tasks;
namespace Waher.Networking.Cluster
{
/// <summary>
/// Event arguments for cluster message acknowledgement events.
/// </summary>
public class ClusterResponseEventArgs<ResponseType> : EventArgs
{
private readonly IClusterCommand command;
private readonly EndpointResponse<ResponseType>[] responses;
private readonly object state;
/// <summary>
/// Event arguments for cluster message acknowledgement events.
/// </summary>
/// <param name="Command">Command object.</param>
/// <param name="Responses">Message acknowledgement responses</param>
/// <param name="State">State object passed on to the original request.</param>
public ClusterResponseEventArgs(IClusterCommand Command, EndpointResponse<ResponseType>[] Responses, object State)
: base()
{
this.command = Command;
this.responses = Responses;
this.state = State;
}
/// <summary>
/// Cluster command object.
/// </summary>
public IClusterCommand Command => this.command;
/// <summary>
/// Command execution responses.
/// </summary>
public EndpointResponse<ResponseType>[] Responses => this.responses;
/// <summary>
/// State object passed on to the original request.
/// </summary>
public object State => this.state;
/// <summary>
/// If the command was executed without error on all endpoints.
/// </summary>
public bool Ok
{
get
{
foreach (EndpointResponse<ResponseType> P in this.responses)
{
if (!P.Ok)
return false;
}
return true;
}
}
}
}