Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ReferenceLoader.cs
1using System;
2using System.Threading.Tasks;
3using Waher.Events;
7
9{
13 internal class ReferenceLoader : IDatabaseIteration<PersistedGeoSpatialObjectReference>
14 {
15 private readonly GeoSpatialComponent component;
17
22 public ReferenceLoader(GeoSpatialComponent Component)
23 {
24 this.component = Component;
25 }
26
30 public Task StartDatabase() => Task.CompletedTask;
31
35 public async Task EndDatabase()
36 {
37 if (!(this.expired is null))
38 await Database.Delete(this.expired);
39 }
40
45 public Task StartCollection(string CollectionName) => Task.CompletedTask;
46
50 public Task EndCollection() => Task.CompletedTask;
51
57 public Task ProcessObject(PersistedGeoSpatialObjectReference Object)
58 {
59 if (Object.Expires.HasValue && Object.Expires.Value <= DateTime.Now.AddMinutes(1))
60 {
62 this.expired.Add(Object);
63 }
64 else
65 this.component.Loaded(Object);
66
67 return Task.CompletedTask;
68 }
69
75 public Task IncompatibleObject(object ObjectId) => Task.CompletedTask;
76
81 public Task ReportException(Exception Exception)
82 {
83 Log.Exception(Exception);
84 return Task.CompletedTask;
85 }
86
87 }
88}
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:14
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1657
Static interface for database persistence. In order to work, a database provider has to be assigned t...
Definition: Database.cs:21
static async Task Delete(object Object)
Deletes an object in the database.
Definition: Database.cs:1291
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
void Add(T Item)
Adds an item to the collection.
Definition: ChunkedList.cs:272
Interface for iterations of database contents.