Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
NullDatabaseProvider.cs
1using System;
3using System.Threading.Tasks;
4using System.Xml;
8
9namespace Waher.Persistence
10{
15 {
20 {
21 }
22
27 public Task Insert(object Object) => Task.CompletedTask;
28
33 public Task Insert(params object[] Objects) => Task.CompletedTask;
34
39 public Task Insert(IEnumerable<object> Objects) => Task.CompletedTask;
40
46 public Task InsertLazy(object Object, ObjectCallback Callback) => Task.CompletedTask;
47
53 public Task InsertLazy(object[] Objects, ObjectsCallback Callback) => Task.CompletedTask;
54
60 public Task InsertLazy(IEnumerable<object> Objects, ObjectsCallback Callback) => Task.CompletedTask;
61
71 public Task<IEnumerable<T>> Find<T>(int Offset, int MaxCount, params string[] SortOrder)
72 where T : class
73 {
74 return Task.FromResult<IEnumerable<T>>(Array.Empty<T>());
75 }
76
87 public Task<IEnumerable<T>> Find<T>(int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
88 where T : class
89 {
90 return Task.FromResult<IEnumerable<T>>(Array.Empty<T>());
91 }
92
102 public Task<IEnumerable<object>> Find(string Collection, int Offset, int MaxCount, params string[] SortOrder)
103 {
104 return Task.FromResult<IEnumerable<object>>(Array.Empty<object>());
105 }
106
117 public Task<IEnumerable<object>> Find(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
118 {
119 return Task.FromResult<IEnumerable<object>>(Array.Empty<object>());
120 }
121
133 public Task<IEnumerable<T>> Find<T>(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
134 where T : class
135 {
136 return Task.FromResult<IEnumerable<T>>(Array.Empty<T>());
137 }
138
147 public Task<IPage<T>> FindFirst<T>(int PageSize, params string[] SortOrder)
148 where T : class
149 {
150 return Task.FromResult<IPage<T>>(new EmptyPage<T>());
151 }
152
162 public Task<IPage<T>> FindFirst<T>(int PageSize, Filter Filter, params string[] SortOrder)
163 where T : class
164 {
165 return Task.FromResult<IPage<T>>(new EmptyPage<T>());
166 }
167
176 public Task<IPage<object>> FindFirst(string Collection, int PageSize, params string[] SortOrder)
177 {
178 return Task.FromResult<IPage<object>>(new EmptyPage<object>());
179 }
180
190 public Task<IPage<object>> FindFirst(string Collection, int PageSize, Filter Filter, params string[] SortOrder)
191 {
192 return Task.FromResult<IPage<object>>(new EmptyPage<object>());
193 }
194
205 public Task<IPage<T>> FindFirst<T>(string Collection, int PageSize, Filter Filter, params string[] SortOrder)
206 where T : class
207 {
208 return Task.FromResult<IPage<T>>(new EmptyPage<T>());
209 }
210
217 public Task<IPage<T>> FindNext<T>(IPage<T> Page)
218 where T : class
219 {
220 return Task.FromResult<IPage<T>>(new EmptyPage<T>());
221 }
222
228 public Task<IPage<object>> FindNext(IPage<object> Page)
229 {
230 return Task.FromResult<IPage<object>>(new EmptyPage<object>());
231 }
232
244 public Task<bool> Process<T>(IProcessor<T> Processor, int Offset, int MaxCount, params string[] SortOrder)
245 where T : class
246 {
247 return Task.FromResult(false);
248 }
249
262 public Task<bool> Process<T>(IProcessor<T> Processor, int Offset, int MaxCount,
263 Filter Filter, params string[] SortOrder)
264 where T : class
265 {
266 return Task.FromResult(false);
267 }
268
280 public Task<bool> Process(IProcessor<object> Processor, string Collection, int Offset, int MaxCount,
281 params string[] SortOrder)
282 {
283 return Task.FromResult(false);
284 }
285
298 public Task<bool> Process(IProcessor<object> Processor, string Collection, int Offset, int MaxCount,
299 Filter Filter, params string[] SortOrder)
300 {
301 return Task.FromResult(false);
302 }
303
317 public Task<bool> Process<T>(IProcessor<T> Processor, string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
318 where T : class
319 {
320 return Task.FromResult(false);
321 }
322
327 public Task Update(object Object) => Task.CompletedTask;
328
333 public Task Update(params object[] Objects) => Task.CompletedTask;
334
339 public Task Update(IEnumerable<object> Objects) => Task.CompletedTask;
340
346 public Task UpdateLazy(object Object, ObjectCallback Callback) => Task.CompletedTask;
347
353 public Task UpdateLazy(object[] Objects, ObjectsCallback Callback) => Task.CompletedTask;
354
360 public Task UpdateLazy(IEnumerable<object> Objects, ObjectsCallback Callback) => Task.CompletedTask;
361
366 public Task Delete(object Object) => Task.CompletedTask;
367
372 public Task Delete(params object[] Objects) => Task.CompletedTask;
373
378 public Task Delete(IEnumerable<object> Objects) => Task.CompletedTask;
379
385 public Task DeleteLazy(object Object, ObjectCallback Callback) => Task.CompletedTask;
386
392 public Task DeleteLazy(object[] Objects, ObjectsCallback Callback) => Task.CompletedTask;
393
399 public Task DeleteLazy(IEnumerable<object> Objects, ObjectsCallback Callback) => Task.CompletedTask;
400
410 public Task<IEnumerable<T>> FindDelete<T>(int Offset, int MaxCount, params string[] SortOrder)
411 where T : class
412 {
413 return Task.FromResult<IEnumerable<T>>(Array.Empty<T>());
414 }
415
426 public Task<IEnumerable<T>> FindDelete<T>(int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
427 where T : class
428 {
429 return Task.FromResult<IEnumerable<T>>(Array.Empty<T>());
430 }
431
441 public Task<IEnumerable<object>> FindDelete(string Collection, int Offset, int MaxCount, params string[] SortOrder)
442 {
443 return Task.FromResult<IEnumerable<object>>(Array.Empty<object>());
444 }
445
456 public Task<IEnumerable<object>> FindDelete(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
457 {
458 return Task.FromResult<IEnumerable<object>>(Array.Empty<object>());
459 }
460
470 public Task DeleteLazy<T>(int Offset, int MaxCount, string[] SortOrder, ObjectsCallback Callback)
471 where T : class => Task.CompletedTask;
472
483 public Task DeleteLazy<T>(int Offset, int MaxCount, Filter Filter, string[] SortOrder, ObjectsCallback Callback)
484 where T : class => Task.CompletedTask;
485
495 public Task DeleteLazy(string Collection, int Offset, int MaxCount, string[] SortOrder, ObjectsCallback Callback) => Task.CompletedTask;
496
507 public Task DeleteLazy(string Collection, int Offset, int MaxCount, Filter Filter, string[] SortOrder, ObjectsCallback Callback) => Task.CompletedTask;
508
515 public Task<T> TryLoadObject<T>(object ObjectId)
516 where T : class
517 {
518 return default;
519 }
520
528 public Task<T> TryLoadObject<T>(string CollectionName, object ObjectId)
529 where T : class
530 {
531 return default;
532 }
533
540 public Task<object> TryLoadObject(string CollectionName, object ObjectId)
541 {
542 return null;
543 }
544
551 public Task<bool> Export(IDatabaseExport Output, string[] CollectionNames) => Task.FromResult(true);
552
560 public Task<bool> Export(IDatabaseExport Output, string[] CollectionNames, ProfilerThread Thread) => Task.FromResult(true);
561
569 public Task Iterate<T>(IDatabaseIteration<T> Recipient, string[] CollectionNames)
570 where T : class
571 {
572 return Task.CompletedTask;
573 }
574
583 public Task Iterate<T>(IDatabaseIteration<T> Recipient, string[] CollectionNames, ProfilerThread Thread)
584 where T : class
585 {
586 return Task.CompletedTask;
587 }
588
594 public Task Clear(string CollectionName) => Task.CompletedTask;
595
604 public Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
605 {
606 return Task.FromResult(Array.Empty<string>());
607 }
608
618 public Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread)
619 {
620 return Task.FromResult(Array.Empty<string>());
621 }
622
631 public Task<string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
632 {
633 return Task.FromResult(Array.Empty<string>());
634 }
635
645 public Task<string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread)
646 {
647 return Task.FromResult(Array.Empty<string>());
648 }
649
659 public Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair)
660 {
661 return Task.FromResult(Array.Empty<string>());
662 }
663
674 public Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair, ProfilerThread Thread)
675 {
676 return Task.FromResult(Array.Empty<string>());
677 }
678
684 public Task<string[]> Repair(params string[] CollectionNames)
685 {
686 return Task.FromResult(Array.Empty<string>());
687 }
688
695 public Task<string[]> Repair(ProfilerThread Thread, params string[] CollectionNames)
696 {
697 return Task.FromResult(Array.Empty<string>());
698 }
699
706 public Task AddIndex(string CollectionName, string[] FieldNames) => Task.CompletedTask;
707
714 public Task RemoveIndex(string CollectionName, string[] FieldNames) => Task.CompletedTask;
715
723 public Task<string[][]> GetIndices(string CollectionName) => Task.FromResult(new string[0][]);
724
728 public Task StartBulk() => Task.CompletedTask;
729
733 public Task EndBulk() => Task.CompletedTask;
734
738 public Task Start() => Task.CompletedTask;
739
743 public Task Stop() => Task.CompletedTask;
744
748 public Task Flush() => Task.CompletedTask;
749
753 public int ObjectIdByteCount => 0;
754
760 public Task<IPersistentDictionary> GetDictionary(string Collection) => throw new InvalidOperationException("Server is shutting down.");
761
766 public Task<string[]> GetDictionaries() => Task.FromResult(Array.Empty<string>());
767
774 public Task<IPersistedQueue> GetQueue(string QueueName, bool CanBeNull) =>
775 throw new InvalidOperationException("Server is shutting down.");
776
781 public Task<string[]> GetQueues() => Task.FromResult(Array.Empty<string>());
782
787 public Task<string[]> GetCollections()
788 {
789 return Task.FromResult(Array.Empty<string>());
790 }
791
797 public Task<string> GetCollection(Type Type)
798 {
799 return Task.FromResult(string.Empty);
800 }
801
807 public Task<string> GetCollection(Object Object)
808 {
809 return Task.FromResult(string.Empty);
810 }
811
819 public Task<bool> IsLabel(string Collection, string Label)
820 {
821 return Task.FromResult(false);
822 }
823
828 public Task<string[]> GetLabels(string Collection)
829 {
830 return Task.FromResult(Array.Empty<string>());
831 }
832
838 public Task<object> TryGetObjectId(object Object)
839 {
840 return Task.FromResult<object>(null);
841 }
842
847 public Task DropCollection(string CollectionName) => Task.CompletedTask;
848
854 public Task<GenericObject> Generalize(object Object) => Task.FromResult<GenericObject>(null);
855
861 public Task<object> Specialize(GenericObject Object) => Task.FromResult<object>(null);
862
867 public string[] GetExcludedCollections() => Array.Empty<string>();
868 }
869}
Represents an empty page of items.
Definition: EmptyPage.cs:12
Base class for all filter classes.
Definition: Filter.cs:15
Task< string[]> GetLabels(string Collection)
Gets an array of available labels for a collection.
Task Delete(params object[] Objects)
Deletes a collection of objects in the database.
string[] GetExcludedCollections()
Gets an array of collections that should be excluded from backups.
Task Flush()
Persists any pending changes.
Task< object > TryLoadObject(string CollectionName, object ObjectId)
Tries to load an object given its Object ID ObjectId and its collection name CollectionName .
Task Insert(object Object)
Inserts an object into the database.
Task< bool > Process(IProcessor< object > Processor, string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
Processes untyped objects.
Task DeleteLazy(string Collection, int Offset, int MaxCount, string[] SortOrder, ObjectsCallback Callback)
Finds objects in a given collection and deletes them in the same atomic operation.
Task< IEnumerable< T > > Find< T >(int Offset, int MaxCount, params string[] SortOrder)
Finds objects of a given class T .
Task< IPersistedQueue > GetQueue(string QueueName, bool CanBeNull)
Gets a persistent dictionary containing objects in a collection.
Task< IPage< object > > FindNext(IPage< object > Page)
Finds the next page of objects in a given collection.
Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair, ProfilerThread Thread)
Analyzes the database and exports findings to XML.
Task< string[]> GetQueues()
Gets an array of available queue names.
Task< IEnumerable< object > > Find(string Collection, int Offset, int MaxCount, params string[] SortOrder)
Finds objects in a given collection.
Task Update(IEnumerable< object > Objects)
Updates a collection of objects in the database.
Task DeleteLazy(object[] Objects, ObjectsCallback Callback)
Deletes a collection of objects in the database, if unlocked. If locked, objects will be deleted at n...
Task< bool > Export(IDatabaseExport Output, string[] CollectionNames)
Performs an export of the database.
Task< IEnumerable< object > > FindDelete(string Collection, int Offset, int MaxCount, params string[] SortOrder)
Finds objects in a given collection and deletes them in the same atomic operation.
Task Insert(IEnumerable< object > Objects)
Inserts a collection of objects into the database.
Task DeleteLazy(IEnumerable< object > Objects, ObjectsCallback Callback)
Deletes a collection of objects in the database, if unlocked. If locked, objects will be deleted at n...
Task DeleteLazy(string Collection, int Offset, int MaxCount, Filter Filter, string[] SortOrder, ObjectsCallback Callback)
Finds objects in a given collection and deletes them in the same atomic operation.
Task< bool > Process(IProcessor< object > Processor, string Collection, int Offset, int MaxCount, params string[] SortOrder)
Processes untyped objects.
Task< IPage< object > > FindFirst(string Collection, int PageSize, params string[] SortOrder)
Finds the first page of objects in a given collection.
Task< string[]> Repair(ProfilerThread Thread, params string[] CollectionNames)
Repairs a set of collections.
Task< IEnumerable< T > > FindDelete< T >(int Offset, int MaxCount, params string[] SortOrder)
Finds objects of a given class T and deletes them in the same atomic operation.
Task< IPage< T > > FindNext< T >(IPage< T > Page)
Finds the next page of objects of a given class T .
Task Clear(string CollectionName)
Clears a collection of all objects.
Task InsertLazy(object[] Objects, ObjectsCallback Callback)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
Task Start()
Called when processing starts.
Task EndBulk()
Ends bulk-processing of data. Must be called once for every call to StartBulk.
Task AddIndex(string CollectionName, string[] FieldNames)
Adds an index to a collection, if one does not already exist.
Task< IEnumerable< object > > Find(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
Finds objects in a given collection.
Task< string[]> Repair(params string[] CollectionNames)
Repairs a set of collections.
Task Update(object Object)
Updates an object in the database.
Task Update(params object[] Objects)
Updates a collection of objects in the database.
Task< IPersistentDictionary > GetDictionary(string Collection)
Gets a persistent dictionary containing objects in a collection.
Task Delete(IEnumerable< object > Objects)
Deletes a collection of objects in the database.
Task< bool > Process< T >(IProcessor< T > Processor, int Offset, int MaxCount, params string[] SortOrder)
Processes objects of a given class T .
Task< string > GetCollection(Object Object)
Gets the collection corresponding to a given object.
Task< GenericObject > Generalize(object Object)
Creates a generalized representation of an object.
Task StartBulk()
Starts bulk-proccessing of data. Must be followed by a call to EndBulk.
Task UpdateLazy(object[] Objects, ObjectsCallback Callback)
Updates a collection of objects in the database, if unlocked. If locked, objects will be updated at n...
Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread)
Analyzes the database and exports findings to XML.
Task< IPage< object > > FindFirst(string Collection, int PageSize, Filter Filter, params string[] SortOrder)
Finds the first page of objects in a given collection.
Task UpdateLazy(IEnumerable< object > Objects, ObjectsCallback Callback)
Updates a collection of objects in the database, if unlocked. If locked, objects will be updated at n...
Task DeleteLazy< T >(int Offset, int MaxCount, string[] SortOrder, ObjectsCallback Callback)
Finds objects of a given class T and deletes them in the same atomic operation.
Task< string > GetCollection(Type Type)
Gets the collection corresponding to a given type.
Task RemoveIndex(string CollectionName, string[] FieldNames)
Removes an index from a collection, if one exist.
Task< bool > Export(IDatabaseExport Output, string[] CollectionNames, ProfilerThread Thread)
Performs an export of the database.
Task Delete(object Object)
Deletes an object in the database.
Task DropCollection(string CollectionName)
Drops a collection, if it exist.
Task< IPage< T > > FindFirst< T >(int PageSize, params string[] SortOrder)
Finds the first page of objects of a given class T .
Task Insert(params object[] Objects)
Inserts a collection of objects into the database.
Task< object > TryGetObjectId(object Object)
Tries to get the Object ID of an object, if it exists.
Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
Analyzes the database and exports findings to XML.
Task InsertLazy(object Object, ObjectCallback Callback)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair)
Analyzes the database and exports findings to XML.
Task< string[]> GetDictionaries()
Gets an array of available dictionary collections.
Task< string[]> GetCollections()
Gets an array of available collections.
Task UpdateLazy(object Object, ObjectCallback Callback)
Updates an object in the database, if unlocked. If locked, object will be updated at next opportunity...
Task< IEnumerable< object > > FindDelete(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
Finds objects in a given collection and deletes them in the same atomic operation.
Task< string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
Analyzes the database and repairs it if necessary. Results are exported to XML.
Task< string[][]> GetIndices(string CollectionName)
Removes an index from a collection, if one exist.
Task< object > Specialize(GenericObject Object)
Creates a specialized representation of a generic object.
Task DeleteLazy(object Object, ObjectCallback Callback)
Deletes an object in the database, if unlocked. If locked, object will be deleted at next opportunity...
Task< bool > IsLabel(string Collection, string Label)
Checks if a string is a label in a given collection.
Task InsertLazy(IEnumerable< object > Objects, ObjectsCallback Callback)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
Task< string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread)
Analyzes the database and repairs it if necessary. Results are exported to XML.
Task Stop()
Called when processing ends.
Generic object. Contains a sequence of properties.
Class that keeps track of events and timing for one thread.
Interface for database providers that can be plugged into the static Database class.
Interface for paginated results.
Definition: IPage.cs:11
Interface for processors of objects.
Definition: IProcessor.cs:9
Interface for iterations of database contents.
delegate void ObjectCallback(object Object)
Method called when a process has completed for an object.
delegate void ObjectsCallback(IEnumerable< object > Objects)
Method called when a process has completed for a set of objects.