Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SynchronizationStatus.cs
1using System;
2using System.Collections.Generic;
3
5{
10 {
11 private readonly List<KeyValuePair<string, string>> blockErrorsMessages = new List<KeyValuePair<string, string>>();
12 private DateTime first = DateTime.MaxValue;
13 private DateTime last = DateTime.MinValue;
14 private uint nrBlocks = 0;
15 private uint nrNew = 0;
16 private uint nrUpdated = 0;
17 private uint nrLoaded = 0;
18 private uint nrDenied = 0;
19 private uint blockErrors = 0;
20 private uint objectErrors = 0;
21 private ulong totalBytes = 0;
22 private ulong loadedBytes = 0;
23 private ulong events = 0;
24 private ulong objectsAdded = 0;
25 private ulong objectsDeleted = 0;
26 private ulong objectsUpdated = 0;
27 private bool done = false;
28
33 {
34 }
35
39 public DateTime First
40 {
41 get => this.first;
42 internal set => this.first = value;
43 }
44
48 public DateTime Last
49 {
50 get => this.last;
51 internal set => this.last = value;
52 }
53
57 public uint NrBlocks
58 {
59 get => this.nrBlocks;
60 internal set => this.nrBlocks = value;
61 }
62
66 public uint NrNew
67 {
68 get => this.nrNew;
69 internal set => this.nrNew = value;
70 }
71
75 public uint NrUpdated
76 {
77 get => this.nrUpdated;
78 internal set => this.nrUpdated = value;
79 }
80
84 public uint NrLoaded
85 {
86 get => this.nrLoaded;
87 internal set => this.nrLoaded = value;
88 }
89
93 public uint NrDenied
94 {
95 get => this.nrDenied;
96 internal set => this.nrDenied = value;
97 }
98
102 public uint BlockErrors
103 {
104 get => this.blockErrors;
105 }
106
112 internal void IncBlockError(string Peer, string Message)
113 {
114 this.IncBlockError(Peer, Message, 1);
115 }
116
123 internal void IncBlockError(string Peer, string Message, uint NrBlocks)
124 {
125 lock (this.blockErrorsMessages)
126 {
127 this.blockErrors += NrBlocks;
128 this.blockErrorsMessages.Add(new KeyValuePair<string, string>(Peer, Message));
129 }
130 }
131
136 public KeyValuePair<string, string>[] PopBlockErrorMessages()
137 {
138 KeyValuePair<string, string>[] Result;
139
140 lock (this.blockErrorsMessages)
141 {
142 if (this.blockErrorsMessages.Count == 0)
143 Result = null;
144 else
145 {
146 Result = this.blockErrorsMessages.ToArray();
147 this.blockErrorsMessages.Clear();
148 }
149 }
150
151 return Result;
152 }
153
157 public uint ObjectErrors
158 {
159 get => this.objectErrors;
160 internal set => this.objectErrors = value;
161 }
162
166 public ulong TotalBytes
167 {
168 get => this.totalBytes;
169 internal set => this.totalBytes = value;
170 }
171
175 public ulong LoadedBytes
176 {
177 get => this.loadedBytes;
178 internal set => this.loadedBytes = value;
179 }
180
184 public ulong Events
185 {
186 get => this.events;
187 internal set => this.events = value;
188 }
189
193 public ulong ObjectsAdded
194 {
195 get => this.objectsAdded;
196 internal set => this.objectsAdded = value;
197 }
198
202 public ulong ObjectsUpdated
203 {
204 get => this.objectsUpdated;
205 internal set => this.objectsUpdated = value;
206 }
207
211 public ulong ObjectsDeleted
212 {
213 get => this.objectsDeleted;
214 internal set => this.objectsDeleted = value;
215 }
216
220 public bool Done
221 {
222 get => this.done;
223 internal set => this.done = value;
224 }
225 }
226}
KeyValuePair< string, string >[] PopBlockErrorMessages()
Returns the latest block error messages reported.