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;
2using System.Collections.Generic;
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
206 Task Update(object Object);
207
212 Task Update(params object[] Objects);
213
218 Task Update(IEnumerable<object> Objects);
219
225 Task UpdateLazy(object Object, ObjectCallback Callback);
226
232 Task UpdateLazy(object[] Objects, ObjectsCallback Callback);
233
239 Task UpdateLazy(IEnumerable<object> Objects, ObjectsCallback Callback);
240
245 Task Delete(object Object);
246
251 Task Delete(params object[] Objects);
252
257 Task Delete(IEnumerable<object> Objects);
258
264 Task DeleteLazy(object Object, ObjectCallback Callback);
265
271 Task DeleteLazy(object[] Objects, ObjectsCallback Callback);
272
278 Task DeleteLazy(IEnumerable<object> Objects, ObjectsCallback Callback);
279
289 Task<IEnumerable<T>> FindDelete<T>(int Offset, int MaxCount, params string[] SortOrder)
290 where T : class;
291
302 Task<IEnumerable<T>> FindDelete<T>(int Offset, int MaxCount, Filter Filter, params string[] SortOrder)
303 where T : class;
304
314 Task<IEnumerable<object>> FindDelete(string Collection, int Offset, int MaxCount, params string[] SortOrder);
315
326 Task<IEnumerable<object>> FindDelete(string Collection, int Offset, int MaxCount, Filter Filter, params string[] SortOrder);
327
337 Task DeleteLazy<T>(int Offset, int MaxCount, string[] SortOrder, ObjectsCallback Callback)
338 where T : class;
339
350 Task DeleteLazy<T>(int Offset, int MaxCount, Filter Filter, string[] SortOrder, ObjectsCallback Callback)
351 where T : class;
352
362 Task DeleteLazy(string Collection, int Offset, int MaxCount, string[] SortOrder, ObjectsCallback Callback);
363
374 Task DeleteLazy(string Collection, int Offset, int MaxCount, Filter Filter, string[] SortOrder, ObjectsCallback Callback);
375
382 Task<T> TryLoadObject<T>(object ObjectId)
383 where T : class;
384
392 Task<T> TryLoadObject<T>(string CollectionName, object ObjectId)
393 where T : class;
394
401 Task<object> TryLoadObject(string CollectionName, object ObjectId);
402
409 Task<bool> Export(IDatabaseExport Output, string[] CollectionNames);
410
418 Task<bool> Export(IDatabaseExport Output, string[] CollectionNames, ProfilerThread Thread);
419
427 Task Iterate<T>(IDatabaseIteration<T> Recipient, string[] CollectionNames)
428 where T : class;
429
438 Task Iterate<T>(IDatabaseIteration<T> Recipient, string[] CollectionNames, ProfilerThread Thread)
439 where T : class;
440
446 Task Clear(string CollectionName);
447
456 Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData);
457
467 Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread);
468
477 Task<string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData);
478
488 Task<string[]> Repair(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, ProfilerThread Thread);
489
499 Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair);
500
511 Task<string[]> Analyze(XmlWriter Output, string XsltPath, string ProgramDataFolder, bool ExportData, bool Repair, ProfilerThread Thread);
512
518 Task<string[]> Repair(params string[] CollectionNames);
519
526 Task<string[]> Repair(ProfilerThread Thread, params string[] CollectionNames);
527
534 Task AddIndex(string CollectionName, string[] FieldNames);
535
542 Task RemoveIndex(string CollectionName, string[] FieldNames);
543
547 Task StartBulk();
548
552 Task EndBulk();
553
557 Task Start();
558
562 Task Stop();
563
567 Task Flush();
568
573 {
574 get;
575 }
576
582 Task<IPersistentDictionary> GetDictionary(string Collection);
583
588 Task<string[]> GetDictionaries();
589
594 Task<string[]> GetCollections();
595
601 Task<string> GetCollection(Type Type);
602
608 Task<string> GetCollection(Object Object);
609
617 Task<bool> IsLabel(string Collection, string Label);
618
624 Task<string[]> GetLabels(string Collection);
625
631 Task<object> TryGetObjectId(object Object);
632
637 Task DropCollection(string CollectionName);
638
644 Task<GenericObject> Generalize(object Object);
645
651 Task<object> Specialize(GenericObject Object);
652
658 }
659}
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< 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< 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 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< 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 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< 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 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.