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
52 public Task<bool> StartLedger()
53 {
54 return this.output?.StartLedger() ?? Task.FromResult(true);
55 }
56
61 public Task<bool> EndLedger()
62 {
63 return this.output?.EndLedger() ?? Task.FromResult(true);
64 }
65
71 public Task<bool> StartCollection(string CollectionName)
72 {
73 this.nrCollections++;
74 return this.output?.StartCollection(CollectionName) ?? Task.FromResult(true);
75 }
76
81 public Task<bool> EndCollection()
82 {
83 return this.output?.EndCollection() ?? Task.FromResult(true);
84 }
85
91 public Task<bool> StartBlock(string BlockID)
92 {
93 this.nrBlocks++;
94 return this.output?.StartBlock(BlockID) ?? Task.FromResult(true);
95 }
96
103 public Task<bool> BlockMetaData(string Key, object Value)
104 {
105 return this.output?.BlockMetaData(Key, Value) ?? Task.FromResult(true);
106 }
107
112 public Task<bool> EndBlock()
113 {
114 return this.output?.EndBlock() ?? Task.FromResult(true);
115 }
116
125 public Task<bool> StartEntry(string ObjectId, string TypeName, EntryType EntryType, DateTimeOffset EntryTimestamp)
126 {
127 this.nrEntries++;
128 return this.output?.StartEntry(ObjectId, TypeName, EntryType, EntryTimestamp) ?? Task.FromResult(true);
129 }
130
137 public Task<bool> ReportProperty(string PropertyName, object PropertyValue)
138 {
139 this.nrProperties++;
140 return this.output?.ReportProperty(PropertyName, PropertyValue) ?? Task.FromResult(true);
141 }
142
147 public Task<bool> EndEntry()
148 {
149 return this.output?.EndEntry() ?? Task.FromResult(true);
150 }
151
157 public Task<bool> CollectionCleared(DateTimeOffset EntryTimestamp)
158 {
159 return this.output?.CollectionCleared(EntryTimestamp) ?? Task.FromResult(true);
160 }
161
167 public Task<bool> ReportError(string Message)
168 {
169 return this.output?.ReportError(Message) ?? Task.FromResult(true);
170 }
171
177 public Task<bool> ReportException(Exception Exception)
178 {
179 return this.output?.ReportException(Exception) ?? Task.FromResult(true);
180 }
181 }
182}
Task< bool > EndEntry()
Is called when an entry is finished.
Task< bool > ReportException(Exception Exception)
Is called when an exception has occurred.
Task< bool > StartLedger()
Is called when export of ledger is started.
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 > 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.
EntryType
Ledger entry type.
Definition: ILedgerEntry.cs:9