Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
IDatabaseProvider.cs
1using System;
3using System.Xml;
4using System.Threading.Tasks;
8
9namespace Waher.Persistence
10{
15 public delegate void ObjectCallback(object Object);
16
21 public delegate void ObjectsCallback(IEnumerable<object> Objects);
22
26 public interface IDatabaseProvider
27 {
32 Task Insert(object Object);
33
38 Task Insert(params object[] Objects);
39
44 Task Insert(IEnumerable<object> Objects);
45
51 Task InsertLazy(object Object, ObjectCallback Callback);
52
58 Task InsertLazy(object[] Objects, ObjectsCallback Callback);
59
65 Task InsertLazy(IEnumerable<object> Objects, ObjectsCallback Callback);
66
76 Task<IEnumerable<T>> Find<T>(int Offset, int MaxCount, params string[] SortOrder)
77 where T : class;
78
89 Task<IEnumerable<T>> Find<T>(int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
90 where T : class;
91
101 Task<IEnumerable<object>> Find(string Collection, int Offset, int MaxCount, params string[] SortOrder);
102
113 Task<IEnumerable<object>> Find(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder);
114
126 Task<IEnumerable<T>> Find<T>(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
127 where T : class;
128
137 Task<IPage<T>> FindFirst<T>(int PageSize, params string[] SortOrder)
138 where T : class;
139
149 Task<IPage<T>> FindFirst<T>(int PageSize, Filter Filter, params string[] SortOrder)
150 where T : class;
151
160 Task<IPage<object>> FindFirst(string Collection, int PageSize, params string[] SortOrder);
161
171 Task<IPage<object>> FindFirst(string Collection, int PageSize, Filter Filter, params string[] SortOrder);
172
183 Task<IPage<T>> FindFirst<T>(string Collection, int PageSize, Filter Filter, params string[] SortOrder)
184 where T : class;
185
192 Task<IPage<T>> FindNext<T>(IPage<T> Page)
193 where T : class;
194
200 Task<IPage<object>> FindNext(IPage<object> Page);
201
213 Task<bool> Process<T>(IProcessor<T> Processor, int Offset, int MaxCount, params string[] SortOrder)
214 where T : class;
215
228 Task<bool> Process<T>(IProcessor<T> Processor, int Offset, int MaxCount,
229 Filter Filter, params string[] SortOrder)
230 where T : class;
231
243 Task<bool> Process(IProcessor<object> Processor, string Collection, int Offset, int MaxCount,
244 params string[] SortOrder);
245
258 Task<bool> Process(IProcessor<object> Processor, string Collection, int Offset, int MaxCount,
259 Filter Filter, params string[] SortOrder);
260
274 Task<bool> Process<T>(IProcessor<T> Processor, string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
275 where T : class;
276
281 Task Update(object Object);
282
287 Task Update(params object[] Objects);
288
293 Task Update(IEnumerable<object> Objects);
294
300 Task UpdateLazy(object Object, ObjectCallback Callback);
301
307 Task UpdateLazy(object[] Objects, ObjectsCallback Callback);
308
314 Task UpdateLazy(IEnumerable<object> Objects, ObjectsCallback Callback);
315
320 Task Delete(object Object);
321
326 Task Delete(params object[] Objects);
327
332 Task Delete(IEnumerable<object> Objects);
333
339 Task DeleteLazy(object Object, ObjectCallback Callback);
340
346 Task DeleteLazy(object[] Objects, ObjectsCallback Callback);
347
353 Task DeleteLazy(IEnumerable<object> Objects, ObjectsCallback Callback);
354
364 Task<IEnumerable<T>> FindDelete<T>(int Offset, int MaxCount, params string[] SortOrder)
365 where T : class;
366
377 Task<IEnumerable<T>> FindDelete<T>(int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
378 where T : class;
379
389 Task<IEnumerable<object>> FindDelete(string Collection, int Offset, int MaxCount, params string[] SortOrder);
390
401 Task<IEnumerable<object>> FindDelete(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder);
402
412 Task DeleteLazy<T>(int Offset, int MaxCount, string[] SortOrder, ObjectsCallback Callback)
413 where T : class;
414
425 Task DeleteLazy<T>(int Offset, int MaxCount, Filter Filter, string[] SortOrder, ObjectsCallback Callback)
426 where T : class;
427
437 Task DeleteLazy(string Collection, int Offset, int MaxCount, string[] SortOrder, ObjectsCallback Callback);
438
449 Task DeleteLazy(string Collection, int Offset, int MaxCount, Filter Filter, string[] SortOrder, ObjectsCallback Callback);
450
457 Task<T> TryLoadObject<T>(object ObjectId)
458 where T : class;
459
467 Task<T> TryLoadObject<T>(string CollectionName, object ObjectId)
468 where T : class;
469
476 Task<object> TryLoadObject(string CollectionName, object ObjectId);
477
484 Task<bool> Export(IDatabaseExport Output, string[] CollectionNames);
485
493 Task<bool> Export(IDatabaseExport Output, string[] CollectionNames, ProfilerThread Thread);
494
502 Task Iterate<T>(IDatabaseIteration<T> Recipient, string[] CollectionNames)
503 where T : class;
504
513 Task Iterate<T>(IDatabaseIteration<T> Recipient, string[] CollectionNames, ProfilerThread Thread)
514 where T : class;
515
521 Task Clear(string CollectionName);
522
531 Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData);
532
542 Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread);
543
552 Task<string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData);
553
563 Task<string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread);
564
574 Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair);
575
586 Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair, ProfilerThread Thread);
587
593 Task<string[]> Repair(params string[] CollectionNames);
594
601 Task<string[]> Repair(ProfilerThread Thread, params string[] CollectionNames);
602
609 Task AddIndex(string CollectionName, string[] FieldNames);
610
617 Task RemoveIndex(string CollectionName, string[] FieldNames);
618
626 Task<string[][]> GetIndices(string CollectionName);
627
631 Task StartBulk();
632
636 Task EndBulk();
637
641 Task Start();
642
646 Task Stop();
647
651 Task Flush();
652
657 {
658 get;
659 }
660
666 Task<IPersistentDictionary> GetDictionary(string Collection);
667
672 Task<string[]> GetDictionaries();
673
680 Task<IPersistedQueue> GetQueue(string QueueName, bool CanBeNull);
681
686 Task<string[]> GetQueues();
687
692 Task<string[]> GetCollections();
693
699 Task<string> GetCollection(Type Type);
700
706 Task<string> GetCollection(Object Object);
707
715 Task<bool> IsLabel(string Collection, string Label);
716
722 Task<string[]> GetLabels(string Collection);
723
729 Task<object> TryGetObjectId(object Object);
730
735 Task DropCollection(string CollectionName);
736
742 Task<GenericObject> Generalize(object Object);
743
749 Task<object> Specialize(GenericObject Object);
750
756 }
757}
Base class for all filter classes.
Definition: Filter.cs:15
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.
Task< string[]> Repair(ProfilerThread Thread, params string[] CollectionNames)
Repairs a set of collections.
Task Update(object Object)
Updates an object in 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 Insert(params object[] Objects)
Inserts a collection of objects into the database.
Task< IEnumerable< T > > Find< T >(int Offset, int MaxCount, params string[] SortOrder)
Finds objects of a given class T .
Task InsertLazy(object Object, ObjectCallback Callback)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
Task Delete(IEnumerable< object > Objects)
Deletes a collection of objects in the database.
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< string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
Analyzes the database and repairs it if necessary. Results are exported to XML.
Task< object > TryLoadObject(string CollectionName, object ObjectId)
Tries to load an object given its Object ID ObjectId and its collection name CollectionName .
Task< bool > Process(IProcessor< object > Processor, string Collection, int Offset, int MaxCount, Filter Filter, 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< object > TryGetObjectId(object Object)
Tries to get the Object ID of an object, if it exists.
Task AddIndex(string CollectionName, string[] FieldNames)
Adds an index to a collection, if one does not already exist.
Task Delete(object Object)
Deletes an object in the database.
Task< object > Specialize(GenericObject Object)
Creates a specialized representation of a generic object.
Task< IEnumerable< object > > Find(string Collection, int Offset, int MaxCount, params string[] SortOrder)
Finds objects in a given collection.
Task< string[]> Repair(params string[] CollectionNames)
Repairs a set of collections.
Task Flush()
Persists any pending changes.
Task< bool > IsLabel(string Collection, string Label)
Checks if a string is a label in a given collection.
Task< bool > Process< T >(IProcessor< T > Processor, int Offset, int MaxCount, params string[] SortOrder)
Processes objects of a given class T .
Task< string[]> GetLabels(string Collection)
Gets an array of available labels for a collection.
Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair)
Analyzes the database and exports findings to XML.
Task Delete(params object[] Objects)
Deletes a collection of objects in the database.
Task< string > GetCollection(Type Type)
Gets the collection corresponding to a given type.
Task Start()
Called when processing starts.
Task< bool > Export(IDatabaseExport Output, string[] CollectionNames)
Performs an export of the database.
Task Update(params object[] Objects)
Updates a collection of objects in the database.
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< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread)
Analyzes the database and exports findings to XML.
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[]> GetCollections()
Gets an array of available collections.
Task Clear(string CollectionName)
Clears a collection of all 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 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 Iterate< T >(IDatabaseIteration< T > Recipient, string[] CollectionNames)
Performs an iteration of contents of the entire database.
Task< string[]> GetDictionaries()
Gets an array of available dictionary collections.
Task< IPersistedQueue > GetQueue(string QueueName, bool CanBeNull)
Gets a persistent dictionary containing objects in a collection.
Task EndBulk()
Ends bulk-processing of data. Must be called once for every call to StartBulk.
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< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair, ProfilerThread Thread)
Analyzes the database and exports findings to XML.
Task UpdateLazy(object Object, ObjectCallback Callback)
Updates an object in the database, if unlocked. If locked, object will be updated at next opportunity...
Task< T > TryLoadObject< T >(object ObjectId)
Tries to load an object given its Object ID ObjectId and its class type T .
int ObjectIdByteCount
Number of bytes used by an Object ID.
Task< GenericObject > Generalize(object Object)
Creates a generalized representation of an object.
Task Insert(IEnumerable< object > Objects)
Inserts a collection of objects into the database.
Task< string[][]> GetIndices(string CollectionName)
Removes an index from a collection, if one exist.
Task< IEnumerable< object > > Find(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
Finds objects in a given collection.
Task Insert(object Object)
Inserts an object into the database.
Task< IPage< object > > FindFirst(string Collection, int PageSize, Filter Filter, params string[] SortOrder)
Finds the first page of objects in a given collection.
Task InsertLazy(object[] Objects, ObjectsCallback Callback)
Inserts an object into the database, if unlocked. If locked, object will be inserted at next opportun...
Task< IPage< T > > FindNext< T >(IPage< T > Page)
Finds the next page of objects of a given class T .
Task< IPage< T > > FindFirst< T >(int PageSize, params string[] SortOrder)
Finds the first page of objects of a given class T .
Task DeleteLazy(object Object, ObjectCallback Callback)
Deletes an object in the database, if unlocked. If locked, object will be deleted at next opportunity...
Task< IPersistentDictionary > GetDictionary(string Collection)
Gets a persistent dictionary containing objects in a collection.
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[]> GetQueues()
Gets an array of available queue names.
Task Stop()
Called when processing ends.
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< bool > Process(IProcessor< object > Processor, string Collection, int Offset, int MaxCount, params string[] SortOrder)
Processes untyped objects.
Task< string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData)
Analyzes the database and exports findings to XML.
string[] GetExcludedCollections()
Gets an array of collections that should be excluded from backups.
Task< bool > Export(IDatabaseExport Output, string[] CollectionNames, ProfilerThread Thread)
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 Update(IEnumerable< object > Objects)
Updates a collection of objects in the database.
Task DropCollection(string CollectionName)
Drops a collection, if it exist.
Task< string > GetCollection(Object Object)
Gets the collection corresponding to a given object.
Task RemoveIndex(string CollectionName, string[] FieldNames)
Removes an index from a collection, if one exist.
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< IPage< object > > FindNext(IPage< object > Page)
Finds the next page of objects in a given collection.
Task StartBulk()
Starts bulk-proccessing of data. Must be followed by a call to EndBulk.
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.