Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ExportCounter.cs
1using System;
2using System.Threading.Tasks;
5
7{
12 {
13 private readonly ILedgerExport output;
14 private long nrCollections = 0;
15 private long nrBlocks = 0;
16 private long nrEntries = 0;
17 private long nrProperties = 0;
18
24 {
25 this.output = Output;
26 }
27
31 public long NrCollections => this.nrCollections;
32
36 public long NrBlocks => this.nrBlocks;
37
41 public long NrEntries => this.nrEntries;
42
46 public long NrProperties => this.nrProperties;
47
53 public Task<bool> StartLedger(ILedgerProvider Provider)
54 {
55 return this.output?.StartLedger(Provider) ?? Task.FromResult(true);
56 }
57
62 public Task<bool> EndLedger()
63 {
64 return this.output?.EndLedger() ?? Task.FromResult(true);
65 }
66
72 public Task<bool> StartCollection(string CollectionName)
73 {
74 this.nrCollections++;
75 return this.output?.StartCollection(CollectionName) ?? Task.FromResult(true);
76 }
77
82 public Task<bool> EndCollection()
83 {
84 return this.output?.EndCollection() ?? Task.FromResult(true);
85 }
86
92 public Task<bool> StartBlock(string BlockID)
93 {
94 this.nrBlocks++;
95 return this.output?.StartBlock(BlockID) ?? Task.FromResult(true);
96 }
97
104 public Task<bool> BlockMetaData(string Key, object Value)
105 {
106 return this.output?.BlockMetaData(Key, Value) ?? Task.FromResult(true);
107 }
108
113 public Task<bool> EndBlock()
114 {
115 return this.output?.EndBlock() ?? Task.FromResult(true);
116 }
117
126 public Task<bool> StartEntry(string ObjectId, string TypeName, EntryType EntryType, DateTimeOffset EntryTimestamp)
127 {
128 this.nrEntries++;
129 return this.output?.StartEntry(ObjectId, TypeName, EntryType, EntryTimestamp) ?? Task.FromResult(true);
130 }
131
138 public Task<bool> ReportProperty(string PropertyName, object PropertyValue)
139 {
140 this.nrProperties++;
141 return this.output?.ReportProperty(PropertyName, PropertyValue) ?? Task.FromResult(true);
142 }
143
148 public Task<bool> EndEntry()
149 {
150 return this.output?.EndEntry() ?? Task.FromResult(true);
151 }
152
158 public Task<bool> CollectionCleared(DateTimeOffset EntryTimestamp)
159 {
160 return this.output?.CollectionCleared(EntryTimestamp) ?? Task.FromResult(true);
161 }
162
168 public Task<bool> ReportError(string Message)
169 {
170 return this.output?.ReportError(Message) ?? Task.FromResult(true);
171 }
172
178 public Task<bool> ReportException(Exception Exception)
179 {
180 return this.output?.ReportException(Exception) ?? Task.FromResult(true);
181 }
182 }
183}
Task< bool > EndEntry()
Is called when an entry is finished.
Task< bool > ReportException(Exception Exception)
Is called when an exception has occurred.
Task< bool > CollectionCleared(DateTimeOffset EntryTimestamp)
Is called when the collection has been cleared.
long NrCollections
Number of collections processed
long NrProperties
Number of properties processed
Task< bool > BlockMetaData(string Key, object Value)
Reports block meta-data.
Task< bool > StartBlock(string BlockID)
Is called when a block in a collection is started.
Task< bool > StartEntry(string ObjectId, string TypeName, EntryType EntryType, DateTimeOffset EntryTimestamp)
Is called when an entry is started.
ExportCounter(ILedgerExport Output)
Class that counts exported elements.
Task< bool > StartLedger(ILedgerProvider Provider)
Is called when export of ledger is started.
Task< bool > EndLedger()
Is called when export of ledger is finished.
Task< bool > EndCollection()
Is called when a collection is finished.
Task< bool > EndBlock()
Is called when a block in a collection is finished.
Task< bool > ReportProperty(string PropertyName, object PropertyValue)
Is called when a property is reported.
Task< bool > ReportError(string Message)
Is called when an error is reported.
Task< bool > StartCollection(string CollectionName)
Is called when a collection is started.
Interface for ledger providers that can be plugged into the static Ledger class.
EntryType
Ledger entry type.
Definition: ILedgerEntry.cs:9